[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise4/kdepim/korganizer
From: Allen Winter <winter () kde ! org>
Date: 2009-12-31 22:51:00
Message-ID: 1262299860.102144.806.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1068335 by winterz:
in agenda view, show the timezone name not the timezone country.
then adjust the width of the timelabels accordingly to so the
timezone names fit nicely.
part of kolab/issue3493
MERGE: trunk
M +20 -3 koagendaview.cpp
M +2 -2 koagendaview.h
M +1 -1 multiagendaview.cpp
M +1 -8 timelabels.cpp
--- branches/kdepim/enterprise4/kdepim/korganizer/koagendaview.cpp #1068334:1068335
@@ -766,9 +766,10 @@
mTimeBarHeaders.clear();
foreach ( TimeLabels *timeLabel, mTimeLabelsZone->timeLabels() ) {
- QLabel *label = new QLabel( i18n( "All Day" ), mTimeBarHeaderFrame );
- label->setText( timeLabel->header() );
- label->setAlignment( Qt::AlignBottom | Qt::AlignHCenter );
+ QLabel *label = new QLabel( timeLabel->header().replace( '/', "/ " ),
+ mTimeBarHeaderFrame );
+ label->setAlignment( Qt::AlignBottom | Qt::AlignLeft );
+ label->setMargin( 2 );
label->setWordWrap( true );
label->setToolTip( timeLabel->headerToolTip() );
mTimeBarHeaders.append( label );
@@ -779,8 +780,24 @@
{
createTimeBarHeaders();
+ QFontMetrics fm( font() );
+
+ int num = 0;
int width = mTimeLabelsZone->timeLabelsWidth();
+ foreach( QLabel *l, mTimeBarHeaders ) {
+ num++;
+ foreach( const QString &word, l->text().split( ' ' ) ) {
+ width = qMax( width, fm.width( word ) );
+ }
+ }
+ if ( num > 0 ) {
+ width += ( num * 2 ) + 2;
+ if ( num > 1 ) {
+ width += ( num * fm.averageCharWidth() );
+ }
+ }
+
mTimeBarHeaderFrame->setFixedWidth( width );
mTimeLabelsZone->setTimeLabelsWidth( width );
}
--- branches/kdepim/enterprise4/kdepim/korganizer/koagendaview.h #1068334:1068335
@@ -183,7 +183,7 @@
void clearTimeSpanSelection();
- /** Notifies agenda that there are pending changes */
+ /** Notifies agenda that there are pending changes */
void setUpdateNeeded();
// Used by the timelabelszone
@@ -252,7 +252,7 @@
QWidget *mTimeBarHeaderFrame;
QGridLayout *mAgendaLayout;
QSplitter *mSplitterAgenda;
- QList<QWidget *> mTimeBarHeaders;
+ QList<QLabel *> mTimeBarHeaders;
KOAgenda *mAllDayAgenda;
KOAgenda *mAgenda;
--- branches/kdepim/enterprise4/kdepim/korganizer/multiagendaview.cpp #1068334:1068335
@@ -44,7 +44,7 @@
topLevelLayout->setMargin( 0 );
QFontMetrics fm( font() );
- int topLabelHeight = 2 * fm.lineSpacing() + 6; // 3 * 2: spacing in the KOAgendaView
+ int topLabelHeight = 2 * fm.height() + fm.lineSpacing();
KVBox *topSideBox = new KVBox( this );
QWidget *topSideSpacer = new QWidget( topSideBox );
--- branches/kdepim/enterprise4/kdepim/korganizer/timelabels.cpp #1068334:1068335
@@ -374,14 +374,7 @@
QString TimeLabels::header() const
{
- KTimeZone tz = mSpec.timeZone();
-
- QString header = tz.countryCode();
- if ( header.isEmpty() ) {
- header = tz.name();
- }
-
- return header;
+ return mSpec.timeZone().name();
}
QString TimeLabels::headerToolTip() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic