-rw-r--r-- | korganizer/journalentry.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index f0e0f86..739949d 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -79,17 +79,20 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
79 | QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); | 79 | QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); |
80 | vb->setStretchFactor (textLabel,1); | 80 | vb->setStretchFactor (textLabel,1); |
81 | vb->setStretchFactor( toggleJournal, 1 ); | 81 | vb->setStretchFactor( toggleJournal, 1 ); |
82 | mTitle = new KOLocationBox(TRUE, vb, 30); | 82 | mTitle = new KOLocationBox(TRUE, vb, 30); |
83 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 83 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
84 | mCalendarBox = new QComboBox(vb); | 84 | mCalendarBox = new QComboBox(vb); |
85 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 85 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
86 | #ifndef DESKTOP_VERSION | 86 | #ifndef DESKTOP_VERSION |
87 | mTitle->setSizeLimit( 8 ); | 87 | mTitle->setSizeLimit( 8 ); |
88 | mCalendarBox->setSizeLimit( 8 ); | 88 | mCalendarBox->setSizeLimit( 8 ); |
89 | #endif | 89 | #endif |
90 | vb->setStretchFactor ( mTitle, 8 ); | 90 | vb->setStretchFactor ( mTitle, 8 ); |
91 | vb->setStretchFactor ( mCalendarBox, 3 ); | 91 | int limit = 3; |
92 | if ( QApplication::desktop()->width() < 640 ) | ||
93 | limit = 6; | ||
94 | vb->setStretchFactor ( mCalendarBox, limit ); | ||
92 | //mTitleLabel->setMargin(0); | 95 | //mTitleLabel->setMargin(0); |
93 | //mTitleLabel->setAlignment(AlignCenter); | 96 | //mTitleLabel->setAlignment(AlignCenter); |
94 | QPushButton * loadTemplate = new QPushButton( vb ); | 97 | QPushButton * loadTemplate = new QPushButton( vb ); |
95 | QPushButton * saveTemplate = new QPushButton( vb ); | 98 | QPushButton * saveTemplate = new QPushButton( vb ); |
@@ -115,10 +118,16 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
115 | #endif | 118 | #endif |
116 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); | 119 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); |
117 | mDeskWid = QApplication::desktop()->width(); | 120 | mDeskWid = QApplication::desktop()->width(); |
118 | int maxwid = mDeskWid - mMaxWidDiff; | 121 | int maxwid = mDeskWid - mMaxWidDiff; |
119 | mTitle->setMaximumWidth( maxwid/2 +20 ); | 122 | if ( QApplication::desktop()->width() < 640 ) { |
120 | mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | 123 | mTitle->setMaximumWidth( maxwid/2 +20 ); |
124 | mCalendarBox->setMaximumWidth( maxwid/2 -20); | ||
125 | } else { | ||
126 | mTitle->setMaximumWidth( (maxwid/4)*3); | ||
127 | mCalendarBox->setMaximumWidth( maxwid/2 ); | ||
128 | } | ||
129 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | ||
121 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 130 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
122 | QBoxLayout *topLayout = new QVBoxLayout(this); | 131 | QBoxLayout *topLayout = new QVBoxLayout(this); |
123 | topLayout->addWidget(vb); | 132 | topLayout->addWidget(vb); |
124 | topLayout->addWidget(mEditor); | 133 | topLayout->addWidget(mEditor); |
@@ -136,16 +145,24 @@ JournalEntry::~JournalEntry() | |||
136 | } | 145 | } |
137 | void JournalEntry::resizeEvent(QResizeEvent* e ) | 146 | void JournalEntry::resizeEvent(QResizeEvent* e ) |
138 | { | 147 | { |
139 | #ifndef DESKTOP_VERSION | 148 | #ifndef DESKTOP_VERSION |
149 | |||
140 | if ( mDeskWid != QApplication::desktop()->width() ) { | 150 | if ( mDeskWid != QApplication::desktop()->width() ) { |
141 | mDeskWid == QApplication::desktop()->width(); | 151 | mDeskWid == QApplication::desktop()->width(); |
142 | int maxwid = mDeskWid - mMaxWidDiff; | 152 | int maxwid = mDeskWid - mMaxWidDiff; |
143 | mTitle->setMaximumWidth( maxwid/2 +20 ); | 153 | if ( QApplication::desktop()->width() < 640 ) { |
144 | mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | 154 | mTitle->setMaximumWidth( maxwid/2 +20 ); |
155 | mCalendarBox->setMaximumWidth( maxwid/2 -20); | ||
156 | } | ||
157 | else { | ||
158 | mTitle->setMaximumWidth( (maxwid/4)*3); | ||
159 | mCalendarBox->setMaximumWidth( maxwid/2 ); | ||
160 | } | ||
161 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | ||
145 | } | 162 | } |
146 | setMaximumWidth( QApplication::desktop()->width() ); | 163 | //setMaximumWidth( QApplication::desktop()->width() ); |
147 | qDebug("MAXXX %d ", QApplication::desktop()->width()); | 164 | //qDebug("MAXXX %d ", QApplication::desktop()->width()); |
148 | #endif | 165 | #endif |
149 | QFrame::resizeEvent( e ); | 166 | QFrame::resizeEvent( e ); |
150 | } | 167 | } |
151 | QSize JournalEntry::sizeHint() const | 168 | QSize JournalEntry::sizeHint() const |