-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 6014eca..2294f3c 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp @@ -1,140 +1,142 @@ /**************************************************************************** ** GPL by Rajko Albrecht ** ** ** ** ** ****************************************************************************/ #include "datebookdayallday.h" #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qobjectlist.h> #include <qpe/event.h> #include <qpe/ir.h> #include <qpe/datebookdb.h> #include <qpe/resource.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qregexp.h> #include <qdatetime.h> #include "datebookday.h" /* * Constructs a DatebookdayAllday which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) : QScrollView( parent, name ),item_count(0),dateBook(db) { if ( !name ) setName( "DatebookdayAllday" ); setMinimumSize( QSize( 0, 0 ) ); setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); m_MainFrame = new QFrame(viewport()); m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); setFrameStyle(QFrame::NoFrame|QFrame::Plain); - setResizePolicy( QScrollView::AutoOneFit ); + setResizePolicy( QScrollView::Default ); + setHScrollBarMode( AlwaysOff ); addChild(m_MainFrame); datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); datebookdayalldayLayout->setSpacing( 0 ); datebookdayalldayLayout->setMargin( 0 ); lblDesc = new DatebookEventDesc(parent->parentWidget(),""); lblDesc->setBackgroundColor(Qt::yellow); lblDesc->hide(); subWidgets.setAutoDelete(true); } /* * Destroys the object and frees any allocated resources */ DatebookdayAllday::~DatebookdayAllday() { // no need to delete child widgets, Qt does it all for us } DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) { DatebookAlldayDisp * lb; lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); + lb->show(); datebookdayalldayLayout->addWidget(lb); subWidgets.append(lb); - + connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&))); ++item_count; return lb; } void DatebookdayAllday::removeAllEvents() { subWidgets.clear(); item_count = 0; } DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, QWidget* parent,const char* name,WFlags f) : QLabel(parent,name,f),m_Ev(ev),dateBook(db) { QString strDesc = m_Ev.description(); strDesc = strDesc.replace(QRegExp("<"),"<"); setBackgroundColor(yellow); setText(strDesc); setFrameStyle(QFrame::Raised|QFrame::Panel); - + int s = QFontMetrics(font()).height()+4; setMaximumHeight( s ); setMinimumSize( QSize( 0, s ) ); } DatebookAlldayDisp::~DatebookAlldayDisp() { } void DatebookAlldayDisp::beam_single_event() { // create an Event and beam it... /* * Start with the easy stuff. If start and end date is the same we can just use * the values of effective m_Events * If it is a multi day m_Event we need to find the real start and end date... */ if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { Event m_Event( m_Ev.event() ); QDateTime dt( m_Ev.date(), m_Ev.start() ); m_Event.setStart( dt ); dt.setTime( m_Ev.end() ); m_Event.setEnd( dt ); emit beamMe( m_Event ); }else { /* * at least the the Times are right now */ QDateTime start( m_Ev.event().start() ); QDateTime end ( m_Ev.event().end () ); /* * ok we know the start date or we need to find it */ if ( m_Ev.start() != QTime( 0, 0, 0 ) ) { start.setDate( m_Ev.date() ); }else { QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook ); start.setDate( dt ); } /* * ok we know now the end date... * else * get to know the offset btw the real start and real end * and then add it to the new start date... |