Bug 108606 - Times totally wrong after zooming out vertically
Summary: Times totally wrong after zooming out vertically
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-05 21:04 UTC by Thomas McGuire
Modified: 2007-02-08 22:27 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas McGuire 2005-07-05 21:04:20 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

When using View->Zoom->Zoom Out Vertically many times, impossible clock times like 31 o'clock are shown at the left timebar. However, only the labels on the timebar seem to be wrong, when creating new events at 31 o'clock, the right time is shown inside the "New Event" dialog.
Comment 1 Reinhold Kainhofer 2005-07-05 21:12:24 UTC
Am Dienstag, 5. Juli 2005 21:04 schrieb Thomas McGuire:
> When using View->Zoom->Zoom Out Vertically many times, impossible clock
> times like 31 o'clock are shown at the left timebar. 


I can't reproduce this using KDE 3.4. Which version are you using?

Cheers,
Reinhold
Comment 2 Thomas McGuire 2005-07-06 13:24:01 UTC
On Tuesday 05 July 2005 21:12, Reinhold Kainhofer wrote:
> I can't reproduce this using KDE 3.4. Which version are you using?

I am using SVN (trunk) from today, 10:00 german time. I do not have the 
qt4/kde4 branch. My kdelibs is from SVN too, but about 2 weeks old.
Do you need more information (screenshots, config files or something like 
that) ?

I can reproduce this with a fresh user account by zooming out vertically maybe 
5 or 6 times.

Note that there was a recent commit related to the timebar, but I am not sure 
if this behavior was introduced with that commit or if it also was like that 
before.
> SVN commit 419239 by danimo:
>
> Merge code from KO/Pi that actually makes the hourlabel look nice. Big
> fonts for hours, small ones for 00 or am/pm respectively. For an example
> see
> http://developer.kde.org/~danimo/screenies/korganizer_fancyhourlabel.png

Comment 3 Reinhold Kainhofer 2005-07-06 14:10:40 UTC
On Wednesday 06 July 2005 13:24, Thomas McGuire wrote:
> I am using SVN (trunk) from today, 10:00 german time. I do not have the
> qt4/kde4 branch. My kdelibs is from SVN too, but about 2 weeks old.
> Do you need more information (screenshots, config files or something like
> that) ?

[...]
> Note that there was a recent commit related to the timebar, but I am not
> sure if this behavior was introduced with that commit or if it also was
> like that before.
>
> > SVN commit 419239 by danimo:
> >
> > Merge code from KO/Pi that actually makes the hourlabel look nice. Big
> > fonts for hours, small ones for 00 or am/pm respectively. For an example
> > see
> > http://developer.kde.org/~danimo/screenies/korganizer_fancyhourlabel.png


Ah, yes, you are right! I can reproduce it with HEAD, but not with 3.4.
It seems that this  merge from Lutz' Ko/PI code into the korganizer code broke 
this...

Cheers,
Reinhold
Comment 4 Reinhold Kainhofer 2005-07-24 22:50:53 UTC
SVN commit 438286 by kainhofe:

The time line merge from KO/Pi introduceda nasty regression (more than 24 hours are shown in a day!). This is the first shot, which works in most cases, but still lots of things remain to be fixed.

CCBUG:108606


 M  +12 -7     koagendaview.cpp  
 M  +4 -4      koagendaview.h  


--- trunk/KDE/kdepim/korganizer/koagendaview.cpp #438285:438286
@@ -87,7 +87,7 @@
   setHScrollBarMode(AlwaysOff);
   setVScrollBarMode(AlwaysOff);
 
-  resizeContents(50,mRows * mCellHeight);
+  resizeContents(50, int(mRows * mCellHeight) );
 
   viewport()->setBackgroundMode( PaletteBackground );
 
@@ -135,7 +135,7 @@
   // end of workaround
 
   int cell = ((int)(cy/mCellHeight));
-  int y = cell * mCellHeight;
+  double y = cell * mCellHeight;
   QFontMetrics fm = fontMetrics();
   QString hour;
   QString suffix = "am";
@@ -149,7 +149,7 @@
       if (cell > 11) suffix = "pm";
 
   if ( timeHeight >  mCellHeight ) {
-    timeHeight = mCellHeight-1;
+    timeHeight = int(mCellHeight-1);
     int pointS = nFont.pointSize();
     while ( pointS > 4 ) {
       nFont.setPointSize( pointS );
@@ -172,7 +172,7 @@
   //p->drawLine(0,0,0,contentsHeight());
   while (y < cy + ch+mCellHeight) {
     // hour, full line
-    p->drawLine( cx, y, cw+2, y );
+    p->drawLine( cx, int(y), cw+2, int(y) );
     hour.setNum(cell);
     // handle 24h and am/pm time formats
     if (KGlobal::locale()->use12Clock()) {
@@ -185,10 +185,10 @@
     int timeWidth = fm.width(hour);
     int offset = startW - timeWidth - tw2 -1 ;
     p->setFont( nFont );
-    p->drawText( offset, y+timeHeight, hour);
+    p->drawText( offset, int(y+timeHeight), hour);
     p->setFont( sFont );
     offset = startW - tw2;
-    p->drawText( offset, y+timeHeight-divTimeHeight, suffix);
+    p->drawText( offset, int(y+timeHeight-divTimeHeight), suffix);
 
     // increment indices
     y += mCellHeight;
@@ -228,7 +228,12 @@
 
   // update HourSize
   mCellHeight = KOPrefs::instance()->mHourSize*4;
-  resizeContents( mMiniWidth,mRows * mCellHeight+1 );
+  // If the agenda is zoomed out so that more then 24 would be shown,
+  // the agenda only shows 24 hours, so we need to take the cell height
+  // from the agenda, which is larger than the configured one!
+  if ( mCellHeight < 4*mAgenda->gridSpacingY() )
+       mCellHeight = 4*mAgenda->gridSpacingY();
+  resizeContents( mMiniWidth, int(mRows * mCellHeight+1) );
 }
 
 /** update time label positions */
--- trunk/KDE/kdepim/korganizer/koagendaview.h #438285:438286
@@ -75,7 +75,7 @@
 
   private:
     int mRows;
-    int mCellHeight;
+    double mCellHeight;
     int mMiniWidth;
     KOAgenda* mAgenda;
 
@@ -143,8 +143,8 @@
     KOAgendaView( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
     virtual ~KOAgendaView();
 
-    
 
+
     /** Returns maximum number of days supported by the koagendaview */
     virtual int maxDatesHint();
 
@@ -210,10 +210,10 @@
 
     void zoomInHorizontally( const QDate& date=QDate() );
     void zoomOutHorizontally( const QDate& date=QDate() );
-    
+
     void zoomInVertically( );
     void zoomOutVertically( );
-    
+
     void zoomView( const int delta, const QPoint &pos,
       const Qt::Orientation orient=Qt::Horizontal );
   signals:
Comment 5 Reinhold Kainhofer 2006-11-02 18:54:16 UTC
Reassigning all KOrganizer bug reports and wishes to the newly created 
korganizer-devel mailing list.
Comment 6 Thomas McGuire 2007-02-08 22:27:49 UTC
Fixed long ago.