summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-30 16:38:38 (UTC)
committer zautrix <zautrix>2005-01-30 16:38:38 (UTC)
commit23d345c877ae9de6a077af3705026d15bb04d1e3 (patch) (unidiff)
tree1c90eaf14b5fe5daf97645bebed2eabbe66b8a89
parenta34c528fdd8d2cdec14bae9ccb0eee54c8e4e374 (diff)
downloadkdepimpi-23d345c877ae9de6a077af3705026d15bb04d1e3.zip
kdepimpi-23d345c877ae9de6a077af3705026d15bb04d1e3.tar.gz
kdepimpi-23d345c877ae9de6a077af3705026d15bb04d1e3.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp2
-rw-r--r--korganizer/koagendaview.cpp3
-rw-r--r--korganizer/koeditorgeneraltodo.h1
-rw-r--r--korganizer/kotodoeditor.cpp12
4 files changed, 13 insertions, 5 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 7c41cab..0aef929 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1440,65 +1440,65 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
1440 } 1440 }
1441 qApp->processEvents(); 1441 qApp->processEvents();
1442 //globalFlagBlockAgendaItemPaint = 0; 1442 //globalFlagBlockAgendaItemPaint = 0;
1443 for ( itemit=oldconflictItems.first(); itemit != 0; 1443 for ( itemit=oldconflictItems.first(); itemit != 0;
1444 itemit=oldconflictItems.next() ) { 1444 itemit=oldconflictItems.next() ) {
1445 globalFlagBlockAgendaItemUpdate = 0; 1445 globalFlagBlockAgendaItemUpdate = 0;
1446 if ( itemit != item ) 1446 if ( itemit != item )
1447 itemit->repaintMe(); 1447 itemit->repaintMe();
1448 globalFlagBlockAgendaItemUpdate = 1; 1448 globalFlagBlockAgendaItemUpdate = 1;
1449 itemit->repaint(); 1449 itemit->repaint();
1450 } 1450 }
1451 blockSignals( false ); 1451 blockSignals( false );
1452 } 1452 }
1453 if ( remove ) { 1453 if ( remove ) {
1454 //qDebug("remove****************************************** "); 1454 //qDebug("remove****************************************** ");
1455 return; 1455 return;
1456 } 1456 }
1457 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); 1457 //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
1458 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); 1458 bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda );
1459 QDate currentDate; 1459 QDate currentDate;
1460 QDateTime dt; 1460 QDateTime dt;
1461 if ( todo->hasCompletedDate() ) 1461 if ( todo->hasCompletedDate() )
1462 dt = todo->completed(); 1462 dt = todo->completed();
1463 else 1463 else
1464 dt = todo->dtDue(); 1464 dt = todo->dtDue();
1465 if ( overdue ) { 1465 if ( overdue ) {
1466 currentDate = QDate::currentDate(); 1466 currentDate = QDate::currentDate();
1467 days += todo->dtDue().date().daysTo( currentDate ); 1467 days += todo->dtDue().date().daysTo( currentDate );
1468 } 1468 }
1469 else 1469 else
1470 currentDate = dt.date(); 1470 currentDate = dt.date();
1471 1471
1472 if ( todo->doesFloat() || overdue ) { 1472 if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) {
1473 if ( ! mAllDayMode ) return; 1473 if ( ! mAllDayMode ) return;
1474 // aldayagenda 1474 // aldayagenda
1475 globalFlagBlockAgendaItemPaint = 1; 1475 globalFlagBlockAgendaItemPaint = 1;
1476 item = insertAllDayItem(todo, currentDate,days, days); 1476 item = insertAllDayItem(todo, currentDate,days, days);
1477 item->show(); 1477 item->show();
1478 1478
1479 } 1479 }
1480 else { 1480 else {
1481 if ( mAllDayMode ) return; 1481 if ( mAllDayMode ) return;
1482 // mAgenda 1482 // mAgenda
1483 globalFlagBlockAgendaItemPaint = 1; 1483 globalFlagBlockAgendaItemPaint = 1;
1484 int endY = timeToY(dt.time()) - 1; 1484 int endY = timeToY(dt.time()) - 1;
1485 int hi = 12/KOPrefs::instance()->mHourSize; 1485 int hi = 12/KOPrefs::instance()->mHourSize;
1486 int startY = endY - 1-hi; 1486 int startY = endY - 1-hi;
1487 item = insertItem(todo,currentDate,days,startY,endY); 1487 item = insertItem(todo,currentDate,days,startY,endY);
1488 item->show(); 1488 item->show();
1489 } 1489 }
1490 qApp->processEvents(); 1490 qApp->processEvents();
1491 globalFlagBlockAgendaItemPaint = 0; 1491 globalFlagBlockAgendaItemPaint = 0;
1492 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); 1492 QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
1493 KOAgendaItem *itemit; 1493 KOAgendaItem *itemit;
1494 for ( itemit=oldconflictItems.first(); itemit != 0; 1494 for ( itemit=oldconflictItems.first(); itemit != 0;
1495 itemit=oldconflictItems.next() ) { 1495 itemit=oldconflictItems.next() ) {
1496 globalFlagBlockAgendaItemUpdate = 0; 1496 globalFlagBlockAgendaItemUpdate = 0;
1497 itemit->repaintMe(); 1497 itemit->repaintMe();
1498 globalFlagBlockAgendaItemUpdate = 1; 1498 globalFlagBlockAgendaItemUpdate = 1;
1499 itemit->repaint(); 1499 itemit->repaint();
1500 } 1500 }
1501 globalFlagBlockAgendaItemUpdate = 0; 1501 globalFlagBlockAgendaItemUpdate = 0;
1502 item->repaintMe(); 1502 item->repaintMe();
1503 globalFlagBlockAgendaItemUpdate = 1; 1503 globalFlagBlockAgendaItemUpdate = 1;
1504 item->repaint(); 1504 item->repaint();
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 42a6f7c..8b79788 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1478,72 +1478,71 @@ void KOAgendaView::newTimeSpanSelected(int gxStart, int gyStart,
1478} 1478}
1479 1479
1480void KOAgendaView::deleteSelectedDateTime() 1480void KOAgendaView::deleteSelectedDateTime()
1481{ 1481{
1482 mTimeSpanBegin.setDate(QDate()); 1482 mTimeSpanBegin.setDate(QDate());
1483 mTimeSpanEnd.setDate(QDate()); 1483 mTimeSpanEnd.setDate(QDate());
1484 mTimeSpanInAllDay = false; 1484 mTimeSpanInAllDay = false;
1485} 1485}
1486 1486
1487void KOAgendaView::keyPressEvent ( QKeyEvent * e ) 1487void KOAgendaView::keyPressEvent ( QKeyEvent * e )
1488{ 1488{
1489 e->ignore(); 1489 e->ignore();
1490} 1490}
1491 1491
1492void KOAgendaView::scrollOneHourUp() 1492void KOAgendaView::scrollOneHourUp()
1493{ 1493{
1494 1494
1495 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); 1495 mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 );
1496} 1496}
1497void KOAgendaView::scrollOneHourDown() 1497void KOAgendaView::scrollOneHourDown()
1498{ 1498{
1499 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); 1499 mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 );
1500} 1500}
1501 1501
1502void KOAgendaView::setStartHour( int h ) 1502void KOAgendaView::setStartHour( int h )
1503{ 1503{
1504 mAgenda->setStartHour( h ); 1504 mAgenda->setStartHour( h );
1505 1505
1506} 1506}
1507 1507
1508void KOAgendaView::updateTodo( Todo * t, int ) 1508void KOAgendaView::updateTodo( Todo * t, int )
1509{ 1509{
1510
1511 bool remove = false; 1510 bool remove = false;
1512 bool removeAD = false; 1511 bool removeAD = false;
1513 QDate da; 1512 QDate da;
1514 if ( t->hasCompletedDate() ) 1513 if ( t->hasCompletedDate() )
1515 da = t->completed().date(); 1514 da = t->completed().date();
1516 else 1515 else
1517 da = t->dtDue().date(); 1516 da = t->dtDue().date();
1518 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { 1517 if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
1519 remove = true; 1518 remove = true;
1520 removeAD = true; 1519 removeAD = true;
1521 } 1520 }
1522 else { 1521 else {
1523 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ; 1522 bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
1524 if ( overdue && 1523 if ( overdue &&
1525 QDate::currentDate() >= mSelectedDates.first() && 1524 QDate::currentDate() >= mSelectedDates.first() &&
1526 QDate::currentDate() <= mSelectedDates.last()) { 1525 QDate::currentDate() <= mSelectedDates.last()) {
1527 removeAD = false; 1526 removeAD = false;
1528 remove = true; 1527 remove = true;
1529 } 1528 }
1530 else { 1529 else {
1531 1530
1532 if ( da < mSelectedDates.first() || 1531 if ( da < mSelectedDates.first() ||
1533 da > mSelectedDates.last() ) { 1532 da > mSelectedDates.last() ) {
1534 remove = true; 1533 remove = true;
1535 removeAD = true; 1534 removeAD = true;
1536 } else { 1535 } else {
1537 remove = t->doesFloat() && !t->hasCompletedDate(); 1536 remove = t->doesFloat() && !t->hasCompletedDate();
1538 removeAD = !remove; 1537 removeAD = !remove;
1539 } 1538 }
1540 } 1539 }
1541 } 1540 }
1542 int days = mSelectedDates.first().daysTo( da ); 1541 int days = mSelectedDates.first().daysTo( da );
1543 // qDebug("daysto %d ", days ); 1542 //qDebug("daysto %d %d %d", days, remove,removeAD );
1544 mAgenda->updateTodo( t , days, remove); 1543 mAgenda->updateTodo( t , days, remove);
1545 if ( KOPrefs::instance()->mShowTodoInAgenda ) 1544 if ( KOPrefs::instance()->mShowTodoInAgenda )
1546 mAllDayAgenda->updateTodo( t , days, removeAD); 1545 mAllDayAgenda->updateTodo( t , days, removeAD);
1547 //qDebug("KOAgendaView::updateTodo( Todo *, int ) "); 1546 //qDebug("KOAgendaView::updateTodo( Todo *, int ) ");
1548 1547
1549} 1548}
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index f6c30f8..5f1c3cc 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -56,50 +56,51 @@ class KOEditorGeneralTodo : public KOEditorGeneral
56 void initPriority(QWidget *, QBoxLayout *); 56 void initPriority(QWidget *, QBoxLayout *);
57 57
58 void finishSetup(); 58 void finishSetup();
59 59
60 /** Set widgets to default values */ 60 /** Set widgets to default values */
61 void setDefaults(QDateTime due,bool allDay); 61 void setDefaults(QDateTime due,bool allDay);
62 /** Read todo object and setup widgets accordingly */ 62 /** Read todo object and setup widgets accordingly */
63 void readTodo(Todo *); 63 void readTodo(Todo *);
64 /** Write todo settings to event object */ 64 /** Write todo settings to event object */
65 void writeTodo(Todo *); 65 void writeTodo(Todo *);
66 66
67 /** Check if the input is valid. */ 67 /** Check if the input is valid. */
68 bool validateInput(); 68 bool validateInput();
69 69
70 /** The todo has been modified externally */ 70 /** The todo has been modified externally */
71 void modified (Todo*, int); 71 void modified (Todo*, int);
72 72
73 signals: 73 signals:
74 void openCategoryDialog(); 74 void openCategoryDialog();
75 75
76 protected slots: 76 protected slots:
77 void completedChanged(int); 77 void completedChanged(int);
78 78
79 void enableDueEdit( bool enable ); 79 void enableDueEdit( bool enable );
80 void enableStartEdit( bool enable ); 80 void enableStartEdit( bool enable );
81 void enableTimeEdits( bool enable ); 81 void enableTimeEdits( bool enable );
82 void showAlarm(); 82 void showAlarm();
83 83
84 protected: 84 protected:
85 void setCompletedDate(); 85 void setCompletedDate();
86 86
87 private: 87 private:
88 friend class KOTodoEditor;
88 KDateEdit *mStartDateEdit; 89 KDateEdit *mStartDateEdit;
89 KOTimeEdit *mStartTimeEdit; 90 KOTimeEdit *mStartTimeEdit;
90 QCheckBox *mTimeButton; 91 QCheckBox *mTimeButton;
91 QCheckBox *mDueCheck; 92 QCheckBox *mDueCheck;
92 KDateEdit *mDueDateEdit; 93 KDateEdit *mDueDateEdit;
93 KOTimeEdit *mDueTimeEdit; 94 KOTimeEdit *mDueTimeEdit;
94 QComboBox *mCompletedCombo; 95 QComboBox *mCompletedCombo;
95 QLabel *mCompletedLabel; 96 QLabel *mCompletedLabel;
96 QLabel *mPriorityLabel; 97 QLabel *mPriorityLabel;
97 QComboBox *mPriorityCombo; 98 QComboBox *mPriorityCombo;
98 99
99 QCheckBox *mStartCheck; 100 QCheckBox *mStartCheck;
100 101
101 QDateTime mCompleted; 102 QDateTime mCompleted;
102}; 103};
103 104
104 105
105#endif 106#endif
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 16c19a4..ec5c2d1 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -16,64 +16,65 @@
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qframe.h> 26#include <qframe.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kfiledialog.h> 36#include <kfiledialog.h>
37#include <kstandarddirs.h> 37#include <kstandarddirs.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39 39
40#include <libkdepim/categoryselectdialog.h> 40#include <libkdepim/categoryselectdialog.h>
41#include <libkcal/calendarlocal.h> 41#include <libkcal/calendarlocal.h>
42#include <libkcal/calendarresources.h> 42#include <libkcal/calendarresources.h>
43#include <libkcal/resourcecalendar.h> 43#include <libkcal/resourcecalendar.h>
44#include <libkcal/icalformat.h> 44#include <libkcal/icalformat.h>
45#include <kresources/resourceselectdialog.h> 45#include <kresources/resourceselectdialog.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48#include "kolocationbox.h"
48 49
49#include "kotodoeditor.h" 50#include "kotodoeditor.h"
50extern int globalFlagBlockAgenda; 51extern int globalFlagBlockAgenda;
51 52
52KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 53KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
53 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 54 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
54{ 55{
55 mTodo = 0; 56 mTodo = 0;
56 mRelatedTodo = 0; 57 mRelatedTodo = 0;
57 findButton(User1)->hide(); 58 findButton(User1)->hide();
58 init(); 59 init();
59} 60}
60 61
61KOTodoEditor::~KOTodoEditor() 62KOTodoEditor::~KOTodoEditor()
62{ 63{
63 emit dialogClose( mTodo ); 64 emit dialogClose( mTodo );
64} 65}
65 66
66void KOTodoEditor::init() 67void KOTodoEditor::init()
67{ 68{
68 setupGeneral(); 69 setupGeneral();
69 setupAttendeesTab(); 70 setupAttendeesTab();
70} 71}
71void KOTodoEditor::setCategories( QString s ) 72void KOTodoEditor::setCategories( QString s )
72{ 73{
73 mGeneral->setCategories(s); 74 mGeneral->setCategories(s);
74} 75}
75void KOTodoEditor::setSecrecy( int sec ) 76void KOTodoEditor::setSecrecy( int sec )
76{ 77{
77 mGeneral->setSecrecy( sec ); 78 mGeneral->setSecrecy( sec );
78} 79}
79void KOTodoEditor::reload() 80void KOTodoEditor::reload()
@@ -247,67 +248,74 @@ void KOTodoEditor::deleteTodo()
247 switch (msgItemDelete()) { 248 switch (msgItemDelete()) {
248 case KMessageBox::Continue: // OK 249 case KMessageBox::Continue: // OK
249 emit todoToBeDeleted(mTodo); 250 emit todoToBeDeleted(mTodo);
250 emit dialogClose(mTodo); 251 emit dialogClose(mTodo);
251 mCalendar->deleteTodo(mTodo); 252 mCalendar->deleteTodo(mTodo);
252 emit todoDeleted(); 253 emit todoDeleted();
253 reject(); 254 reject();
254 break; 255 break;
255 } 256 }
256 } 257 }
257 else { 258 else {
258 emit todoToBeDeleted(mTodo); 259 emit todoToBeDeleted(mTodo);
259 emit dialogClose(mTodo); 260 emit dialogClose(mTodo);
260 mCalendar->deleteTodo(mTodo); 261 mCalendar->deleteTodo(mTodo);
261 emit todoDeleted(); 262 emit todoDeleted();
262 reject(); 263 reject();
263 } 264 }
264 } else { 265 } else {
265 reject(); 266 reject();
266 } 267 }
267} 268}
268 269
269void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) 270void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
270{ 271{
271 mRelatedTodo = relatedEvent; 272 mRelatedTodo = relatedEvent;
272 273
273 mGeneral->setDefaults(due,allDay); 274 mGeneral->setDefaults(due,allDay);
274 mDetails->setDefaults(); 275 mDetails->setDefaults();
275 showPage( 0 ); 276 showPage( 0 );
276 if ( mRelatedTodo ) { 277 if ( mRelatedTodo ) {
277 mGeneral->setCategories (mRelatedTodo->categoriesStr ()); 278 mGeneral->setCategories (mRelatedTodo->categoriesStr ());
278 mGeneral->setSecrecy (mRelatedTodo->secrecy ()); 279 mGeneral->setSecrecy (mRelatedTodo->secrecy ());
280 if ( mRelatedTodo->priority() < 3 )
281 mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
282 mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
283 int len = mRelatedTodo->summary().length();
284 mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
285 mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
286 mGeneral->mSummaryEdit->lineEdit()->setFocus();
279 287
280 } 288 } else
281 mGeneral->setFocusOn( 2 ); 289 mGeneral->setFocusOn( 2 );
282} 290}
283 291
284void KOTodoEditor::readTodo(Todo *todo) 292void KOTodoEditor::readTodo(Todo *todo)
285{ 293{
286 mGeneral->readTodo(todo); 294 mGeneral->readTodo(todo);
287 mDetails->readEvent(todo); 295 mDetails->readEvent(todo);
288 mRelatedTodo = 0;//todo->relatedTo(); 296 mRelatedTodo = 0;//todo->relatedTo();
289 // categories 297 // categories
290 // mCategoryDialog->setSelected(todo->categories()); 298 // mCategoryDialog->setSelected(todo->categories());
291 299
292 // We should handle read-only events here. 300 // We should handle read-only events here.
293} 301}
294 302
295void KOTodoEditor::writeTodo(Todo *event) 303void KOTodoEditor::writeTodo(Todo *event)
296{ 304{
297 mGeneral->writeTodo(event); 305 mGeneral->writeTodo(event);
298 mDetails->writeEvent(event); 306 mDetails->writeEvent(event);
299 307
300 // set related event, i.e. parent to-do in this case. 308 // set related event, i.e. parent to-do in this case.
301 if (mRelatedTodo) { 309 if (mRelatedTodo) {
302 event->setRelatedTo(mRelatedTodo); 310 event->setRelatedTo(mRelatedTodo);
303 } 311 }
304} 312}
305 313
306bool KOTodoEditor::validateInput() 314bool KOTodoEditor::validateInput()
307{ 315{
308 if (!mGeneral->validateInput()) return false; 316 if (!mGeneral->validateInput()) return false;
309 if (!mDetails->validateInput()) return false; 317 if (!mDetails->validateInput()) return false;
310 return true; 318 return true;
311} 319}
312 320
313int KOTodoEditor::msgItemDelete() 321int KOTodoEditor::msgItemDelete()