author | sandman <sandman> | 2002-11-26 23:34:04 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-26 23:34:04 (UTC) |
commit | e52158d2f9e1fdc9766d991dc672729648d5a020 (patch) (side-by-side diff) | |
tree | 2e87e8d9a24cdb336b2d7ca654a5ffa2f80c5f8c /library/datebookmonth.cpp | |
parent | ac4f32931212847803534a72eb5e951bd01e6ff5 (diff) | |
download | opie-e52158d2f9e1fdc9766d991dc672729648d5a020.zip opie-e52158d2f9e1fdc9766d991dc672729648d5a020.tar.gz opie-e52158d2f9e1fdc9766d991dc672729648d5a020.tar.bz2 |
Sharp ROM compatibilty upgrade:
All these functions are needed to get qtmail (from the Sharp ROM) running
on Opie - I have even tested qtmail on an iPAQ and it seems to work ..
-rw-r--r-- | library/datebookmonth.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp index 4a9dcbd..e8be313 100644 --- a/library/datebookmonth.cpp +++ b/library/datebookmonth.cpp @@ -559,192 +559,204 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg, if (ev.isAllDay()) { if (!ev.hasRepeat()) normalAllDay = TRUE; else repeatAllDay = TRUE; } else { int sLine, eLine; if (f == 0) sLine = 0; else if (f < 8 ) sLine = 1; else if (f >= 17) sLine = w - 4; else { sLine = (f - 8) * (w - 8); if (sLine) sLine /= 8; sLine += 4; } if (t == 23) eLine = w; else if (t < 8) eLine = 4; else if (t >= 17) eLine = w - 1; else { eLine = (t - 8) * (w - 8); if (eLine) eLine /= 8; eLine += 4; } if (!ev.hasRepeat()) { normalLine.push(sLine); normalLine.push(eLine); } else { repeatLine.push(sLine); repeatLine.push(eLine); } } } // draw the background if (normalAllDay || repeatAllDay || travelAllDay) { p->save(); if (normalAllDay) if (repeatAllDay) { p->fillRect( 0, 0, cr.width(), cr.height() / 2, colorNormalLight ); p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2, colorRepeatLight ); } else p->fillRect( 0, 0, cr.width(), cr.height(), colorNormalLight ); else if (repeatAllDay) p->fillRect( 0, 0, cr.width(), cr.height(), colorRepeatLight ); } else { p->fillRect( 0, 0, cr.width(), cr.height(), selected ? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Base ) ); } // The lines // now for the lines. int h = 5; int y = cr.height() / 2 - h; while(normalLine.count() >= 2) { int x2 = normalLine.pop(); int x1 = normalLine.pop(); if (x2 < x1 + 2) x2 = x1 + 2; p->fillRect(x1, y, x2 - x1, h, colorNormal); } y += h; while(repeatLine.count() >= 2) { int x2 = repeatLine.pop(); int x1 = repeatLine.pop(); if (x2 < x1 + 2) x2 = x1 + 2; p->fillRect(x1, y, x2 - x1, h, colorRepeat); } // Finally, draw the number. QFont f = p->font(); f.setPointSize( ( f.pointSize() / 3 ) * 2 ); p->setFont( f ); QFontMetrics fm( f ); p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); p->restore(); } void DayItemMonth::setType( Calendar::Day::Type t ) { switch ( t ) { case Calendar::Day::PrevMonth: case Calendar::Day::NextMonth: back = QBrush( QColor( 224, 224, 224 ) ); forg = black; break; case Calendar::Day::ThisMonth: back = QBrush( white ); forg = black; break; } typ = t; } DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) :QPushButton( parent, name ) { longFormat = longDate; df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); setDate( QDate::currentDate() ); connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); } void DateButton::pickDate() { static QPopupMenu *m1 = 0; static DateBookMonth *picker = 0; if ( !m1 ) { m1 = new QPopupMenu( this ); picker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( picker ); connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) ); connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SIGNAL( dateSelected( int, int, int ) ) ); connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); } picker->slotWeekChange( weekStartsMonday ); picker->setDate( currDate.year(), currDate.month(), currDate.day() ); m1->popup(mapToGlobal(QPoint(0,height()))); picker->setFocus(); } void DateButton::gotHide() { // we have to redo the button... setDown( false ); } // void dateSelected( int year, int month, int day ); void DateButton::setWeekStartsMonday( int b ) { weekStartsMonday = b; } void DateButton::setDate( int y, int m, int d ) { setDate( QDate( y,m,d) ); } void DateButton::setDate( QDate d ) { currDate = d; setText( longFormat ? TimeString::longDateString( d, df ) : TimeString::shortDate( d, df ) ); } void DateButton::setDateFormat( DateFormat f ) { df = f; setDate( currDate ); } bool DateButton::customWhatsThis() const { return TRUE; } + +// this class is only here for Sharp ROM compatibility +// I have reverse engineered this class and it seems to +// work (only qtmail seems to use it) - sandman +// DO NOT USE IT IN NEW CODE !! + +DateBookMonthPopup::DateBookMonthPopup ( QWidget *w ) + : QPopupMenu ( w ) +{ + m_dbm = new DateBookMonth( this, 0, TRUE ); + insertItem( m_dbm ); +} |