summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-25 16:06:31 (UTC)
committer zautrix <zautrix>2005-06-25 16:06:31 (UTC)
commit3867528ada39bb50a18802c499fbc3f6fae26e8c (patch) (unidiff)
tree6b619b3bc6dea00e52648b4a394a61ab4ee8a072 /korganizer
parent49d8fe456ce284a512227a7ca9d4d49688a39cd2 (diff)
downloadkdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.zip
kdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.tar.gz
kdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.tar.bz2
fixxxxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.h1
-rw-r--r--korganizer/koeditorgeneralevent.cpp2
-rw-r--r--korganizer/koeditorgeneralevent.h1
-rw-r--r--korganizer/koeditorgeneraltodo.cpp9
-rw-r--r--korganizer/koeditorgeneraltodo.h1
-rw-r--r--korganizer/koeditorrecurrence.cpp42
-rw-r--r--korganizer/koeditorrecurrence.h4
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--korganizer/kotodoeditor.cpp8
9 files changed, 46 insertions, 26 deletions
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index 2069e9c..a8f6443 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -85,6 +85,7 @@ class KOEditorGeneral : public QObject
85 signals: 85 signals:
86 void openCategoryDialog(); 86 void openCategoryDialog();
87 void allAccepted(); 87 void allAccepted();
88 void dateTimesChanged(QDateTime,QDateTime);
88 89
89 protected: 90 protected:
90 int mNextFocus; 91 int mNextFocus;
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index af97ee9..3dd7f5c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -237,7 +237,7 @@ void KOEditorGeneralEvent::startDateChanged(QDate newdate)
237 // adjust end date so that the event has the same duration as before 237 // adjust end date so that the event has the same duration as before
238 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep)); 238 mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
239 mEndDateEdit->setDate(mCurrEndDateTime.date()); 239 mEndDateEdit->setDate(mCurrEndDateTime.date());
240 240 qDebug("KOEditorGeneralEvent::startDateChanged ");
241 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime); 241 emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
242} 242}
243 243
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 9649806..d798905 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -87,7 +87,6 @@ class KOEditorGeneralEvent : public KOEditorGeneral
87 void eTimeChanged(QTime); 87 void eTimeChanged(QTime);
88 88
89 signals: 89 signals:
90 void dateTimesChanged(QDateTime start,QDateTime end);
91 void allDayChanged(bool); 90 void allDayChanged(bool);
92 void dateTimeStrChanged(const QString &); 91 void dateTimeStrChanged(const QString &);
93 92
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index e86b4d0..0a734ee 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -127,7 +127,8 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); 128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); 129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
130 130 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
131 this, SLOT(startDateChanged(QDate)));
131 // some more layouting 132 // some more layouting
132 //layoutTimeBox->setColStretch(3,1); 133 //layoutTimeBox->setColStretch(3,1);
133} 134}
@@ -395,7 +396,11 @@ void KOEditorGeneralTodo::enableStartEdit( bool enable )
395 } 396 }
396 emit datesChecked(); 397 emit datesChecked();
397} 398}
398 399void KOEditorGeneralTodo::startDateChanged(QDate newdate)
400{
401 if ( mDueCheck->isChecked() )
402 emit dateTimesChanged(newdate,mDueDateEdit->date());
403}
399void KOEditorGeneralTodo::enableTimeEdits(bool enable) 404void KOEditorGeneralTodo::enableTimeEdits(bool enable)
400{ 405{
401 if(mStartCheck->isChecked()) { 406 if(mStartCheck->isChecked()) {
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index b198539..2e56a7a 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -75,6 +75,7 @@ class KOEditorGeneralTodo : public KOEditorGeneral
75 void datesChecked(); 75 void datesChecked();
76 76
77 protected slots: 77 protected slots:
78 void startDateChanged(QDate newdate);
78 void completedChanged(int); 79 void completedChanged(int);
79 80
80 void enableDueEdit( bool enable ); 81 void enableDueEdit( bool enable );
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index dea8981..de4e4f7 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -835,12 +835,32 @@ void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
835 mExceptions->setDefaults( end ); 835 mExceptions->setDefaults( end );
836 836
837} 837}
838 838void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to )
839void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) 839{
840 setDateTimes( from, to );
841 QBitArray days( 7 );
842 days.fill( 0 );
843 days.setBit( from.date().dayOfWeek()- 1);
844 mWeekly->setDays( days );
845 bool byPos = mMonthly->byPos();
846 if ( byPos )
847 mMonthly->setByDay( from.date().day()-1 );
848 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
849 if ( ! byPos)
850 mMonthly->setByDay( from.date().day()-1 );
851
852 bool byDay = mYearly->byDay();
853 if ( ! byDay )
854 mYearly->setByDay( from.date().dayOfYear() );
855 mYearly->setByMonth( from.date().month(), from.date().day() );
856 if ( byDay )
857 mYearly->setByDay( from.date().dayOfYear() );
858}
859void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to )
840{ 860{
841 861
842 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); 862 // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
843 setDateTimes( from, to ); 863 //setDateTimes( from, to );
844 864
845 bool enabled = false; 865 bool enabled = false;
846 mEnabledCheck->setChecked( enabled ); 866 mEnabledCheck->setChecked( enabled );
@@ -853,18 +873,10 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
853 showCurrentRule( mRecurrenceChooser->type() ); 873 showCurrentRule( mRecurrenceChooser->type() );
854 874
855 mDaily->setFrequency( 1 ); 875 mDaily->setFrequency( 1 );
856
857 mWeekly->setFrequency( 1 ); 876 mWeekly->setFrequency( 1 );
858 QBitArray days( 7 );
859 days.fill( 0 );
860 days.setBit( from.date().dayOfWeek()- 1);
861 mWeekly->setDays( days );
862 mMonthly->setFrequency( 1 ); 877 mMonthly->setFrequency( 1 );
863 mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
864 mMonthly->setByDay( from.date().day()-1 );
865 mYearly->setFrequency( 1 ); 878 mYearly->setFrequency( 1 );
866 mYearly->setByDay( from.date().dayOfYear() ); 879 setDefaultsDates( from, to );
867 mYearly->setByMonth( from.date().month(), from.date().day() );
868} 880}
869 881
870void KOEditorRecurrence::readEvent(Incidence *event) 882void KOEditorRecurrence::readEvent(Incidence *event)
@@ -876,7 +888,7 @@ void KOEditorRecurrence::readEvent(Incidence *event)
876 else 888 else
877 dtEnd = ((Todo*)event)->dtDue(); 889 dtEnd = ((Todo*)event)->dtDue();
878 890
879 setDefaults( event->dtStart(), dtEnd, true ); 891 setDefaults( event->dtStart(), dtEnd );
880 QBitArray rDays( 7 ); 892 QBitArray rDays( 7 );
881 QPtrList<Recurrence::rMonthPos> rmp; 893 QPtrList<Recurrence::rMonthPos> rmp;
882 QPtrList<int> rmd; 894 QPtrList<int> rmd;
@@ -897,7 +909,7 @@ void KOEditorRecurrence::readEvent(Incidence *event)
897 909
898 switch ( recurs ) { 910 switch ( recurs ) {
899 case Recurrence::rNone: 911 case Recurrence::rNone:
900 setDefaults( event->dtStart(), dtEnd, true ); 912 setDefaults( event->dtStart(), dtEnd );
901 break; 913 break;
902 case Recurrence::rDaily: 914 case Recurrence::rDaily:
903 recurrenceType = RecurrenceChooser::Daily; 915 recurrenceType = RecurrenceChooser::Daily;
@@ -969,7 +981,7 @@ void KOEditorRecurrence::readEvent(Incidence *event)
969 mYearly->setFrequency( f ); 981 mYearly->setFrequency( f );
970 break; 982 break;
971 default: 983 default:
972 setDefaults( event->dtStart(), dtEnd, true ); 984 setDefaults( event->dtStart(), dtEnd );
973 break; 985 break;
974 } 986 }
975 987
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index a15afcb..f398f62 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -271,8 +271,6 @@ class KOEditorRecurrence : public QWidget
271 271
272 enum { Daily, Weekly, Monthly, Yearly }; 272 enum { Daily, Weekly, Monthly, Yearly };
273 273
274 /** Set widgets to default values */
275 void setDefaults( QDateTime from, QDateTime to, bool allday );
276 /** Read event object and setup widgets accordingly */ 274 /** Read event object and setup widgets accordingly */
277 void readEvent( Incidence * ); 275 void readEvent( Incidence * );
278 /** Write event settings to event object */ 276 /** Write event settings to event object */
@@ -282,6 +280,8 @@ class KOEditorRecurrence : public QWidget
282 bool validateInput(); 280 bool validateInput();
283 281
284 public slots: 282 public slots:
283 void setDefaultsDates( QDateTime from, QDateTime to );
284 void setDefaults( QDateTime from, QDateTime to );
285 void setEnabled( bool ); 285 void setEnabled( bool );
286 void setDateTimes( QDateTime start, QDateTime end ); 286 void setDateTimes( QDateTime start, QDateTime end );
287 void setDateTimeStr( const QString & ); 287 void setDateTimeStr( const QString & );
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 02d4a78..75dae34 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -72,7 +72,7 @@ void KOEventEditor::init()
72 72
73 // Propagate date time settings to recurrence tab 73 // Propagate date time settings to recurrence tab
74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
75 mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime))); 75 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), 76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
77 mRecurrence,SLOT(setDateTimeStr(const QString &))); 77 mRecurrence,SLOT(setDateTimeStr(const QString &)));
78 78
@@ -280,7 +280,7 @@ void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
280{ 280{
281 mGeneral->setDefaults(from,to,allDay); 281 mGeneral->setDefaults(from,to,allDay);
282 mDetails->setDefaults(); 282 mDetails->setDefaults();
283 mRecurrence->setDefaults(from,to,allDay); 283 mRecurrence->setDefaults(from,to);
284 showPage( 0 ); 284 showPage( 0 );
285 mGeneral->setFocusOn( 2 ); 285 mGeneral->setFocusOn( 2 );
286} 286}
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 9073bca..8b90ae5 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -75,6 +75,8 @@ void KOTodoEditor::init()
75 setupRecurrence(); 75 setupRecurrence();
76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
78 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
79 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
78} 80}
79void KOTodoEditor::setupRecurrence() 81void KOTodoEditor::setupRecurrence()
80{ 82{
@@ -305,7 +307,7 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
305 } else 307 } else
306 mGeneral->setFocusOn( 2 ); 308 mGeneral->setFocusOn( 2 );
307 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 309 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
308 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 310 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
309} 311}
310void KOTodoEditor::checkRecurrence() 312void KOTodoEditor::checkRecurrence()
311{ 313{
@@ -326,11 +328,11 @@ void KOTodoEditor::checkRecurrence()
326 } 328 }
327 if ( to < from ) 329 if ( to < from )
328 to = from; 330 to = from;
329 mRecurrence->setDefaults(from,to,!time); 331 mRecurrence->setDefaults(from,to);
330 } 332 }
331 } else { 333 } else {
332 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 334 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
333 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); 335 mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
334 } 336 }
335} 337}
336void KOTodoEditor::readTodo(Todo *todo) 338void KOTodoEditor::readTodo(Todo *todo)