-rw-r--r-- | korganizer/journalentry.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index b8a4cf2..f0e0f86 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -75,9 +75,10 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : vb->setMargin ( KDialog::marginHint()-1 ); QPushButton * toggleJournal = new QPushButton( vb ); iconp = SmallIcon("1updownarrow"); toggleJournal->setPixmap (iconp ) ; - vb->setStretchFactor (new QLabel(" "+i18n("Title: "),vb),1); + QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); + vb->setStretchFactor (textLabel,1); vb->setStretchFactor( toggleJournal, 1 ); mTitle = new KOLocationBox(TRUE, vb, 30); mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); mCalendarBox = new QComboBox(vb); @@ -111,8 +112,13 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mEditor = new KTextEdit(this); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); #endif + mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); + mDeskWid = QApplication::desktop()->width(); + int maxwid = mDeskWid - mMaxWidDiff; + mTitle->setMaximumWidth( maxwid/2 +20 ); + mCalendarBox->setMaximumWidth( maxwid/2 -20 ); mEditor->setWordWrap( KTextEdit::WidgetWidth ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(vb); topLayout->addWidget(mEditor); @@ -127,8 +133,22 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : JournalEntry::~JournalEntry() { //qDebug("JournalEntry::~JournalEntry() "); } +void JournalEntry::resizeEvent(QResizeEvent* e ) +{ +#ifndef DESKTOP_VERSION + if ( mDeskWid != QApplication::desktop()->width() ) { + mDeskWid == QApplication::desktop()->width(); + int maxwid = mDeskWid - mMaxWidDiff; + mTitle->setMaximumWidth( maxwid/2 +20 ); + mCalendarBox->setMaximumWidth( maxwid/2 -20 ); + } + setMaximumWidth( QApplication::desktop()->width() ); + qDebug("MAXXX %d ", QApplication::desktop()->width()); +#endif + QFrame::resizeEvent( e ); +} QSize JournalEntry::sizeHint() const { return QSize ( 240, heiHint ); } |