Bug 141360 - New task in kontact offers default date with year "2935093"
Summary: New task in kontact offers default date with year "2935093"
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-07 23:03 UTC by gmud
Modified: 2007-02-12 23:50 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 gmud 2007-02-07 23:03:24 UTC
Version:           1.2.4 (using KDE 3.5.6, Gentoo)
Compiler:          gcc version 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
OS:                Linux (i686) release 2.6.18-suspend2

When opening a new task with kontact the default year of the first date field is "2935093". This problem does not occur when using korganizer as a standalone application.
Comment 1 Allen Winter 2007-02-07 23:12:51 UTC
Verified.
Happens in Kontact only, when selecting New Todo from the File menu or from the dropdown menu.
Comment 2 Allen Winter 2007-02-12 23:50:35 UTC
SVN commit 633025 by winterz:

sideways port SVN commit 632398 by adridg:

BUGS: 141360

- Normalize debug output to use area 5850 (in files I touched)
- Use k_funcinfo instead of writing out function name by hand
- Simplify if (foo) bar(true) else bar(false)
- (this is what it's actually about) call setDefaults in order to
  disable the time and date edits when no due date is given. Also
  set due date to something sensible (not in 200000 years) and
  default to due tomorrow if there's going to be a due date set.

Repairs one of the pim+ bugs Allen complained about. Now I am 
left wondering why RMB on todo list is the only action which 
hard-codes a due date 7 days in advance.


 M  +2 -1      calendarview.cpp  
 M  +16 -2     koagendaview.cpp  
 M  +2 -1      kodialogmanager.cpp  
 M  +8 -8      koeditorgeneraltodo.cpp  
 M  +9 -9      koincidenceeditor.cpp  
 M  +7 -1      kotodoeditor.cpp  
 M  +1 -0      kotodoview.cpp  


--- branches/KDE/3.5/kdepim/korganizer/calendarview.cpp #633024:633025
@@ -987,6 +987,7 @@
 void CalendarView::newTodo( const QString &summary, const QString &description,
                             const QStringList &attachments, const QStringList &attendees )
 {
+  kdDebug(5850) << k_funcinfo << endl;
   KOTodoEditor *todoEditor = mDialogManager->getTodoEditor();
   connectIncidenceEditor( todoEditor );
   todoEditor->newTodo();
@@ -999,7 +1000,7 @@
 
 void CalendarView::newTodo()
 {
-  kdDebug(5850) << "CalendarView::newTodo()" << endl;
+  kdDebug(5850) << k_funcinfo << endl;
   QDateTime dtDue;
   bool allday = true;
   KOTodoEditor *todoEditor = mDialogManager->getTodoEditor();
--- branches/KDE/3.5/kdepim/korganizer/koagendaview.cpp #633024:633025
@@ -1463,9 +1463,23 @@
       for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
         Todo *todo = *todos.at(numTodo);
 
-        if ( ! todo->hasDueDate() ) continue;  // todo shall not be displayed if it has no date
+        // Do not display the todo if it has no due date
+        if ( ! todo->hasDueDate() ) continue;
 
-        // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
+#if 0
+        // Show floating to-dos from start to due date
+        if ( todo->doesFloat() && todo->hasStartDate() ) {
+          if ( ( todo->dtStart().date() <= currentDate ) &&
+               ( todo->dtStart().date() < todo->dtDue().date() ) &&
+               ( todo->dtDue().date() > currentDate ) ) {
+                 mAllDayAgenda->insertAllDayItem( todo, currentDate,
+                                                  curCol, curCol );
+                 continue;
+               }
+        }
+#endif
+        // ToDo items shall be displayed for the day they are due,
+        // but only showed today if they are already overdue.
         // Already completed items can be displayed on their original due date
         bool overdue = todo->isOverdue();
 
--- branches/KDE/3.5/kdepim/korganizer/kodialogmanager.cpp #633024:633025
@@ -66,7 +66,7 @@
     KODialogManager *mDialogManager;
 };
 
-class KODialogManager::EditorDialogVisitor : 
+class KODialogManager::EditorDialogVisitor :
       public KODialogManager::DialogManagerVisitor
 {
   public:
@@ -268,6 +268,7 @@
 
 KOTodoEditor *KODialogManager::getTodoEditor()
 {
+  kdDebug(5850) << k_funcinfo << endl;
   KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), mMainView );
   connectEditor( todoEditor );
   return todoEditor;
--- branches/KDE/3.5/kdepim/korganizer/koeditorgeneraltodo.cpp #633024:633025
@@ -95,6 +95,7 @@
 
 void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
 {
+  kdDebug(5850) << k_funcinfo << endl;
   QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
 
   QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
@@ -224,16 +225,11 @@
 
 void KOEditorGeneralTodo::setDefaults( const QDateTime &due, bool allDay )
 {
-kdDebug()<<"KOEditorGeneralTodo::setDefaults: " << due <<endl;
+  kdDebug(5850) << k_funcinfo << due <<endl;
   KOEditorGeneral::setDefaults(allDay);
 
   mTimeButton->setChecked( !allDay );
-  if(mTimeButton->isChecked()) {
-    mTimeButton->setEnabled(true);
-  }
-  else {
-    mTimeButton->setEnabled(false);
-  }
+  mTimeButton->setEnabled( mTimeButton->isChecked() /* i.e. !allDay */ );
 
   enableTimeEdits( !allDay );
 
@@ -246,9 +242,13 @@
   if ( due.isValid() ) {
     mDueDateEdit->setDate( due.date() );
     mDueTimeEdit->setTime( due.time() );
+  } else {
+    // Make it due tomorrow.
+    mDueDateEdit->setDate( QDate::currentDate().addDays(1) );
+    mDueTimeEdit->setTime( QTime::currentTime() );
   }
 
-  if ( QDateTime::currentDateTime() < due ) {
+  if ( !due.isValid() || (QDateTime::currentDateTime() < due) ) {
     mStartDateEdit->setDate( QDate::currentDate() );
     mStartTimeEdit->setTime( QTime::currentTime() );
   } else {
--- branches/KDE/3.5/kdepim/korganizer/koincidenceeditor.cpp #633024:633025
@@ -219,7 +219,7 @@
 
 QWidget *KOIncidenceEditor::addDesignerTab( const QString &uifile )
 {
-  kdDebug() << "Designer tab: " << uifile << endl;
+  kdDebug(5850) << "Designer tab: " << uifile << endl;
 
   KPIM::DesignerFields *wid = new KPIM::DesignerFields( uifile, 0 );
   mDesignerFields.append( wid );
@@ -286,13 +286,13 @@
 
 void KOIncidenceEditor::writeDesignerFields( Incidence *i )
 {
-  kdDebug() << "KOIncidenceEditor::writeDesignerFields()" << endl;
+  kdDebug(5850) << "KOIncidenceEditor::writeDesignerFields()" << endl;
 
   KCalStorage storage( i );
   KPIM::DesignerFields *fields;
   for( fields = mDesignerFields.first(); fields;
        fields = mDesignerFields.next() ) {
-    kdDebug() << "Write Field " << fields->title() << endl;
+    kdDebug(5850) << "Write Field " << fields->title() << endl;
     fields->save( &storage );
   }
 }
@@ -301,8 +301,8 @@
 void KOIncidenceEditor::setupEmbeddedURLPage( const QString &label,
                                  const QString &url, const QString &mimetype )
 {
-  kdDebug() << "KOIncidenceEditor::setupEmbeddedURLPage()" << endl;
-  kdDebug() << "label=" << label << ", url=" << url << ", mimetype=" << mimetype << endl;
+  kdDebug(5850) << "KOIncidenceEditor::setupEmbeddedURLPage()" << endl;
+  kdDebug(5850) << "label=" << label << ", url=" << url << ", mimetype=" << mimetype << endl;
   QFrame *topFrame = addPage( label );
   QBoxLayout *topLayout = new QVBoxLayout( topFrame );
 
@@ -318,11 +318,11 @@
 
 void KOIncidenceEditor::createEmbeddedURLPages( Incidence *i )
 {
-  kdDebug() << "KOIncidenceEditor::createEmbeddedURLPages()" << endl;
+  kdDebug(5850) << "KOIncidenceEditor::createEmbeddedURLPages()" << endl;
 
   if ( !i ) return;
   if ( !mEmbeddedURLPages.isEmpty() ) {
-kdDebug() << "mEmbeddedURLPages are not empty, clearing it!" << endl;
+    kdDebug(5850) << "mEmbeddedURLPages are not empty, clearing it!" << endl;
     mEmbeddedURLPages.setAutoDelete( true );
     mEmbeddedURLPages.clear();
     mEmbeddedURLPages.setAutoDelete( false );
@@ -342,8 +342,8 @@
   Attachment::List att = i->attachments();
   for ( Attachment::List::Iterator it = att.begin(); it != att.end(); ++it ) {
     Attachment *a = (*it);
-    kdDebug() << "Iterating over the attachments " << endl;
-    kdDebug() << "label=" << a->label() << ", url=" << a->uri() << ", mimetype=" << a->mimeType() << endl;
+    kdDebug(5850) << "Iterating over the attachments " << endl;
+    kdDebug(5850) << "label=" << a->label() << ", url=" << a->uri() << ", mimetype=" << a->mimeType() << endl;
     if ( a && a->showInline() && a->isUri() ) {
       // TODO: Allow more mime-types, but add security checks!
 /*      if ( a->mimeType() == "application/x-designer" ) {
--- branches/KDE/3.5/kdepim/korganizer/kotodoeditor.cpp #633024:633025
@@ -66,8 +66,8 @@
 
 void KOTodoEditor::init()
 {
+  kdDebug(5850) << k_funcinfo << endl;
   setupGeneral();
-//  setupAlarmsTab();
   setupRecurrence();
   setupAttendeesTab();
   setupAttachmentsTab();
@@ -132,6 +132,9 @@
     mGeneral->initCategories( topFrame, detailsLayout );
     mGeneral->initSecrecy( topFrame, detailsLayout );
   }
+  // By default, the To-do has no time associated and
+  // neither a start nor end time.
+  mGeneral->setDefaults( QDateTime(), false );
 
   mGeneral->finishSetup();
 }
@@ -152,6 +155,7 @@
 
 void KOTodoEditor::editIncidence(Incidence *incidence)
 {
+  kdDebug(5850) << k_funcinfo << endl;
   Todo *todo=dynamic_cast<Todo*>(incidence);
   if (todo)
   {
@@ -166,6 +170,7 @@
 
 void KOTodoEditor::newTodo()
 {
+  kdDebug(5850) << k_funcinfo << endl;
   init();
   mTodo = 0;
   setCaption( i18n("New To-do") );
@@ -187,6 +192,7 @@
 
 void KOTodoEditor::loadDefaults()
 {
+  kdDebug(5850) << k_funcinfo << endl;
   setDates( QDateTime::currentDateTime().addDays(7), true, 0 );
 }
 
--- branches/KDE/3.5/kdepim/korganizer/kotodoview.cpp #633024:633025
@@ -829,6 +829,7 @@
 
 void KOTodoView::newTodo()
 {
+  kdDebug() << k_funcinfo << endl;
   emit newTodoSignal( QDate::currentDate().addDays(7) );
 }