Bug 93064 - default duration time is ignored when creating new event
Summary: default duration time is ignored when creating new event
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Reinhold Kainhofer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-10 22:58 UTC by Andreas.von.Rueden
Modified: 2005-07-24 16:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas.von.Rueden 2004-11-10 22:58:15 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    SuSE RPMs
OS:                Linux

Example: you set the default duration time for new events to 2:00 hours.
But when creating a new event the duration time is set to 15 min.
korganizer is used in this case as a part of kontact.
Comment 1 Andreas.von.Rueden 2004-11-10 23:15:16 UTC
No bug - appears only when entering event by mouse in day- or weekdisplay.
Comment 2 Sridhar Dhanapalan 2005-03-18 00:19:40 UTC
I beg to differ. This IS a bug because it is not the behaviour that one would expect. Double-clicking in the Day View pane should honour the user-defined default setting, not impose its own.

See the discussion at http://bugs.gentoo.org/show_bug.cgi?id=82234 for details.
Comment 3 Reinhold Kainhofer 2005-03-22 17:56:05 UTC
Reopening, we need to find a consistent solution...
Comment 4 Reinhold Kainhofer 2005-07-24 16:04:02 UTC
SVN commit 438147 by kainhofe:

In the agenda view, when only one cell (=15 minutes) is selected, use the default duration for a new event instead. The old way was particularly confusing when you double-clicked into the agenda and a 15-minutes event was generated instead of a 2-hour one.

BUG:93064


 M  +19 -7     koagendaview.cpp  


--- trunk/KDE/kdepim/korganizer/koagendaview.cpp #438146:438147
@@ -142,12 +142,12 @@
   int timeHeight =  fm.ascent();
   QFont nFont = font();
   p->setFont( font() );
- 
+
   if (!KGlobal::locale()->use12Clock()) {
       suffix = "00";
   } else
       if (cell > 11) suffix = "pm";
-     
+
   if ( timeHeight >  mCellHeight ) {
     timeHeight = mCellHeight-1;
     int pointS = nFont.pointSize();
@@ -161,13 +161,13 @@
     fm = QFontMetrics( nFont );
     timeHeight = fm.ascent();
   }
-  //timeHeight -= (timeHeight/4-2); 
+  //timeHeight -= (timeHeight/4-2);
   QFont sFont = nFont;
   sFont.setPointSize( sFont.pointSize()/2 );
   QFontMetrics fmS(  sFont );
   int startW = mMiniWidth - frameWidth()-2 ;
   int tw2 = fmS.width(suffix);
-  int divTimeHeight = (timeHeight-1) /2 - 1; 
+  int divTimeHeight = (timeHeight-1) /2 - 1;
   //testline
   //p->drawLine(0,0,0,contentsHeight());
   while (y < cy + ch+mCellHeight) {
@@ -186,7 +186,7 @@
     int offset = startW - timeWidth - tw2 -1 ;
     p->setFont( nFont );
     p->drawText( offset, y+timeHeight, hour);
-    p->setFont( sFont ); 
+    p->setFont( sFont );
     offset = startW - tw2;
     p->drawText( offset, y+timeHeight-divTimeHeight, suffix);
 
@@ -856,8 +856,20 @@
                                       bool &allDay )
 {
   if ( selectionStart().isValid() ) {
-    startDt = selectionStart();
-    endDt = selectionEnd();
+    QDateTime start = selectionStart();
+    QDateTime end = selectionEnd();
+
+    if ( start.secsTo( end ) == 15*60 ) {
+      // One cell in the agenda view selected, e.g.
+      // because of a double-click, => Use the default duration
+      QTime defaultDuration( KOPrefs::instance()->mDefaultDuration.time() );
+      int addSecs = ( defaultDuration.hour()*3600 ) +
+                    ( defaultDuration.minute()*60 );
+      end = start.addSecs( addSecs );
+    }
+
+    startDt = start;
+    endDt = end;
     allDay = selectedIsAllDay();
     return true;
   }