author | zautrix <zautrix> | 2005-07-09 23:58:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 23:58:28 (UTC) |
commit | 2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b (patch) (unidiff) | |
tree | e57782981707d6932940d0489fc942bfeab40dd6 | |
parent | 47370b5d0dea0f29bb929ba13cf45186095c762d (diff) | |
download | kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.zip kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.gz kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.bz2 |
fixxx
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 8 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 24 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 66 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 28 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 4 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 1 | ||||
-rw-r--r-- | libkdepim/kdatepicker.cpp | 1 |
9 files changed, 117 insertions, 24 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index ea7071d..6723dc5 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1465,71 +1465,79 @@ | |||
1465 | { "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, | 1465 | { "After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:","Nach dem Importieren/Laden/Syncen kann es neue Kategorien in den Terminen oder Todos geben, die nicht automatisch der Kategorieliste hinzugefügt werden. Bitte wählen Sie, was <b>jetzt</b> passieren soll:" }, |
1466 | { "Change category list now!","Ändere Kategorieliste jetzt!" }, | 1466 | { "Change category list now!","Ändere Kategorieliste jetzt!" }, |
1467 | { "Edit category list...","Ändere Kategorieliste..." }, | 1467 | { "Edit category list...","Ändere Kategorieliste..." }, |
1468 | { "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, | 1468 | { "Toolbar changes needs a restart!","Neustart benötigt für Toolbaränderungen!" }, |
1469 | { "Filepath: ","Dateipfad: " }, | 1469 | { "Filepath: ","Dateipfad: " }, |
1470 | { "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, | 1470 | { "You can try to reload the calendar in the Resource View!","In der Resourcenansicht können Sie erneut versuchen den Kalender zu laden!" }, |
1471 | { "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" }, | 1471 | { "<b>WARNING:</b> There is a pending suspended alarm!","<b>WARNUNG:</b> Es gibt einen laufenden Suspendalarm!" }, |
1472 | { "Pending Suspend Alarm","Laufender Suspend Alarm" }, | 1472 | { "Pending Suspend Alarm","Laufender Suspend Alarm" }, |
1473 | { "Error loading calendar %1","Fehler beim Laden von Kalender %1" }, | 1473 | { "Error loading calendar %1","Fehler beim Laden von Kalender %1" }, |
1474 | { "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" }, | 1474 | { "Calendar(s) not loaded:","Nicht geladene(r) Kalender:" }, |
1475 | { "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" }, | 1475 | { "Loding of calendar(s) failed","Laden von Kalendern fehlgeschlagen" }, |
1476 | { "Alarm Options","Alarm Einstellungen" }, | 1476 | { "Alarm Options","Alarm Einstellungen" }, |
1477 | { "Delete selected...","Lösche Ausgewählte..." }, | 1477 | { "Delete selected...","Lösche Ausgewählte..." }, |
1478 | { "None","Nichts" }, | 1478 | { "None","Nichts" }, |
1479 | { "Selection","Auswahl" }, | 1479 | { "Selection","Auswahl" }, |
1480 | { "Set categories","Setze Kategorien" }, | 1480 | { "Set categories","Setze Kategorien" }, |
1481 | { "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" }, | 1481 | { "This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!","Das fügt die ausgewählten\nEinträge dem Kalender\n%1\nhinzu und entfernt sie von\nihrem aktuellen Kalender!" }, |
1482 | { "Reset","Neu setzen" }, | 1482 | { "Reset","Neu setzen" }, |
1483 | { "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" }, | 1483 | { "Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?","Möchten Sie Kategorien zu den ausgewählten Einträgen <b>hinzufügen</b> oder die Liste <b>neu setzen</b> (d.h. vorhandene Kategorien löschen)?" }, |
1484 | { "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" }, | 1484 | { "The file\n%1\ndoes not exist!\nShall I create it for you?","Die Datei\n%1\nexistiert nicht!\nSoll sie neu angelegt werden?" }, |
1485 | { "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" }, | 1485 | { "Sorry, cannot create the file\n%1!\nNo calendar added!","Kann leider die Datei\n%1\nnicht anlegen!\nKein Kalender hinzugefügt!" }, |
1486 | { "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" }, | 1486 | { "\nNO\n WRITEABLE\n CALENDAR\n FOUND!\n\nPlease fix your calendar settings!\n","\nKEIN\n SCHREIBBARER\n KALENDER\n GEFUNDEN!\n\nBitte korrigieren Sie\nihre Kalendereinstellungen!\n" }, |
1487 | { "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, | 1487 | { "\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie Datei\n%1\nwurde verändert!\nDatei Grösse: %2 Bytes.\nZuletzt geändert: %3\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, |
1488 | { "Edit","Edit" }, | 1488 | { "Edit","Edit" }, |
1489 | { "Last Modified","Zuletzt geändert" }, | 1489 | { "Last Modified","Zuletzt geändert" }, |
1490 | { "Journal viewer","Journal Anzeige" }, | 1490 | { "Journal viewer","Journal Anzeige" }, |
1491 | { "Configure Calendar Files...","Konfiguriere Kalenderdateien..." }, | 1491 | { "Configure Calendar Files...","Konfiguriere Kalenderdateien..." }, |
1492 | { "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." }, | 1492 | { "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." }, |
1493 | { "Hide Completed","Verstecke erledigte Todos" }, | 1493 | { "Hide Completed","Verstecke erledigte Todos" }, |
1494 | { "Show not Running","Zeige nicht Laufende" }, | 1494 | { "Show not Running","Zeige nicht Laufende" }, |
1495 | { "Click to add new Todo","Klick für neues Todo!" }, | 1495 | { "Click to add new Todo","Klick für neues Todo!" }, |
1496 | { "Show next conflict for","Zeige nächsten Konflikt für" }, | 1496 | { "Show next conflict for","Zeige nächsten Konflikt für" }, |
1497 | { "All events","Alle Termine" }, | 1497 | { "All events","Alle Termine" }, |
1498 | { "Allday events","Ganztagestermine" }, | 1498 | { "Allday events","Ganztagestermine" }, |
1499 | { "Events with time","Termine mit Zeit" }, | 1499 | { "Events with time","Termine mit Zeit" }, |
1500 | { "No conflict found","Kein Konflikt gefunden" }, | 1500 | { "No conflict found","Kein Konflikt gefunden" }, |
1501 | { "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, | 1501 | { "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, |
1502 | { "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, | 1502 | { "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, |
1503 | { "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, | 1503 | { "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, |
1504 | { "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, | 1504 | { "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, |
1505 | { "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, | 1505 | { "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, |
1506 | { "Show date","Zeige Datum" }, | 1506 | { "Show date","Zeige Datum" }, |
1507 | { "No problem!","Null Problemo!" }, | 1507 | { "No problem!","Null Problemo!" }, |
1508 | { "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" }, | 1508 | { "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" }, |
1509 | { "Pi-Sync Port Error","Pi-Sync Port Fehler" }, | 1509 | { "Pi-Sync Port Error","Pi-Sync Port Fehler" }, |
1510 | { "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" }, | 1510 | { "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" }, |
1511 | { "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" }, | 1511 | { "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" }, |
1512 | { "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" }, | 1512 | { "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" }, |
1513 | { "Pi-Sync Error","Pi-Sync Fehler" }, | 1513 | { "Pi-Sync Error","Pi-Sync Fehler" }, |
1514 | { "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" }, | 1514 | { "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" }, |
1515 | { "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" }, | 1515 | { "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" }, |
1516 | { "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." }, | 1516 | { "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." }, |
1517 | { "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" }, | 1517 | { "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" }, |
1518 | { "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" }, | 1518 | { "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" }, |
1519 | { "Pi-Sync: Connected!","Pi-Sync: Verbunden!" }, | 1519 | { "Pi-Sync: Connected!","Pi-Sync: Verbunden!" }, |
1520 | { "Receiving file from remote...","Empfange entfernte Datei..." }, | 1520 | { "Receiving file from remote...","Empfange entfernte Datei..." }, |
1521 | { "Sending back synced file...","Sende synchronisierte Datei zurück..." }, | 1521 | { "Sending back synced file...","Sende synchronisierte Datei zurück..." }, |
1522 | { "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" }, | 1522 | { "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" }, |
1523 | { "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" }, | 1523 | { "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" }, |
1524 | { "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." }, | 1524 | { "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." }, |
1525 | { "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" }, | 1525 | { "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" }, |
1526 | { "Writing back file ...","Schreibe Datei zurück..." }, | 1526 | { "Writing back file ...","Schreibe Datei zurück..." }, |
1527 | { "Sending back file ...","Sende Datei zurück..." }, | 1527 | { "Sending back file ...","Sende Datei zurück..." }, |
1528 | { "Eeek, there I am ticklish!","Hihi, da bin ich kitzlig!" }, | 1528 | { "Eeek, there I am ticklish!","Hihi, da bin ich kitzlig!" }, |
1529 | { "Created","Angelegt" }, | ||
1530 | { "Last Modified Sub","Zuletzt geändertes Sub" }, | ||
1531 | { "","" }, | ||
1532 | { "","" }, | ||
1533 | { "","" }, | ||
1534 | { "","" }, | ||
1535 | { "","" }, | ||
1536 | { "","" }, | ||
1529 | { "","" }, | 1537 | { "","" }, |
1530 | { "","" }, | 1538 | { "","" }, |
1531 | { "","" }, | 1539 | { "","" }, |
1532 | { "","" }, | 1540 | { "","" }, |
1533 | { "","" }, | 1541 | { "","" }, |
1534 | { "","" }, | 1542 | { "","" }, |
1535 | { "","" }, | 1543 | { "","" }, |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 7044e90..f9685e9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -306,129 +306,129 @@ private: | |||
306 | QRadioButton* vcal, *ical, *local, *tz; | 306 | QRadioButton* vcal, *ical, *local, *tz; |
307 | }; | 307 | }; |
308 | class KOCatPrefs : public QDialog | 308 | class KOCatPrefs : public QDialog |
309 | { | 309 | { |
310 | public: | 310 | public: |
311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 311 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
312 | QDialog( parent, name, true ) | 312 | QDialog( parent, name, true ) |
313 | { | 313 | { |
314 | setCaption( i18n("Manage new Categories") ); | 314 | setCaption( i18n("Manage new Categories") ); |
315 | QVBoxLayout* lay = new QVBoxLayout( this ); | 315 | QVBoxLayout* lay = new QVBoxLayout( this ); |
316 | lay->setSpacing( 3 ); | 316 | lay->setSpacing( 3 ); |
317 | lay->setMargin( 3 ); | 317 | lay->setMargin( 3 ); |
318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); | 318 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); |
319 | lay->addWidget( lab ); | 319 | lay->addWidget( lab ); |
320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 320 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
321 | lay->addWidget( format ); | 321 | lay->addWidget( format ); |
322 | format->setExclusive ( true ) ; | 322 | format->setExclusive ( true ) ; |
323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
325 | addCatBut->setChecked( true ); | 325 | addCatBut->setChecked( true ); |
326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
327 | lay->addWidget( ok ); | 327 | lay->addWidget( ok ); |
328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
329 | lay->addWidget( cancel ); | 329 | lay->addWidget( cancel ); |
330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
332 | resize( 200, 200 ); | 332 | resize( 200, 200 ); |
333 | } | 333 | } |
334 | 334 | ||
335 | bool addCat() { return addCatBut->isChecked(); } | 335 | bool addCat() { return addCatBut->isChecked(); } |
336 | private: | 336 | private: |
337 | QRadioButton* addCatBut; | 337 | QRadioButton* addCatBut; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | CalendarView::CalendarView( CalendarResources *calendar, | 342 | CalendarView::CalendarView( CalendarResources *calendar, |
343 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
344 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
345 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
346 | mResourceManager( calendar->resourceManager() ) | 346 | mResourceManager( calendar->resourceManager() ) |
347 | { | 347 | { |
348 | 348 | ||
349 | mEventEditor = 0; | 349 | mEventEditor = 0; |
350 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
351 | 351 | ||
352 | init(); | 352 | init(); |
353 | } | 353 | } |
354 | 354 | ||
355 | CalendarView::CalendarView( Calendar *calendar, | 355 | CalendarView::CalendarView( Calendar *calendar, |
356 | QWidget *parent, const char *name ) | 356 | QWidget *parent, const char *name ) |
357 | : CalendarViewBase( parent, name ), | 357 | : CalendarViewBase( parent, name ), |
358 | mCalendar( calendar ), | 358 | mCalendar( calendar ), |
359 | mResourceManager( 0 ) | 359 | mResourceManager( 0 ) |
360 | { | 360 | { |
361 | 361 | ||
362 | mEventEditor = 0; | 362 | mEventEditor = 0; |
363 | mTodoEditor = 0; | 363 | mTodoEditor = 0; |
364 | init(); | 364 | init(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void CalendarView::init() | 367 | void CalendarView::init() |
368 | { | 368 | { |
369 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 369 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
370 | setFocusPolicy ( NoFocus ); | 370 | //setFocusPolicy ( NoFocus ); |
371 | mViewerCallerIsSearchDialog = false; | 371 | mViewerCallerIsSearchDialog = false; |
372 | mBlockShowDates = false; | 372 | mBlockShowDates = false; |
373 | 373 | ||
374 | mDatePickerMode = 0; | 374 | mDatePickerMode = 0; |
375 | mCurrentSyncDevice = ""; | 375 | mCurrentSyncDevice = ""; |
376 | mViewManager = new KOViewManager( this ); | 376 | mViewManager = new KOViewManager( this ); |
377 | mDialogManager = new KODialogManager( this ); | 377 | mDialogManager = new KODialogManager( this ); |
378 | mEventViewerDialog = 0; | 378 | mEventViewerDialog = 0; |
379 | mModified = false; | 379 | mModified = false; |
380 | mReadOnly = false; | 380 | mReadOnly = false; |
381 | mSelectedIncidence = 0; | 381 | mSelectedIncidence = 0; |
382 | mCalPrinter = 0; | 382 | mCalPrinter = 0; |
383 | mFilters.setAutoDelete(true); | 383 | mFilters.setAutoDelete(true); |
384 | 384 | ||
385 | mCalendar->registerObserver( this ); | 385 | mCalendar->registerObserver( this ); |
386 | // TODO: Make sure that view is updated, when calendar is changed. | 386 | // TODO: Make sure that view is updated, when calendar is changed. |
387 | 387 | ||
388 | mStorage = new FileStorage( mCalendar ); | 388 | mStorage = new FileStorage( mCalendar ); |
389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
390 | 390 | ||
391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
392 | #ifndef KORG_NOSPLITTER | 392 | #ifndef KORG_NOSPLITTER |
393 | // create the main layout frames. | 393 | // create the main layout frames. |
394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
395 | topLayout->addWidget(mPanner); | 395 | topLayout->addWidget(mPanner); |
396 | 396 | ||
397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
398 | "CalendarView::LeftFrame"); | 398 | "CalendarView::LeftFrame"); |
399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
400 | 400 | ||
401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
402 | "CalendarView::DateNavigator" ); | 402 | "CalendarView::DateNavigator" ); |
403 | 403 | ||
404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
406 | mTodoList->setNavigator( mNavigator ); | 406 | mTodoList->setNavigator( mNavigator ); |
407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
408 | 408 | ||
409 | #ifdef KORG_NORESOURCEVIEW | 409 | #ifdef KORG_NORESOURCEVIEW |
410 | mResourceView = 0; | 410 | mResourceView = 0; |
411 | #else | 411 | #else |
412 | if ( mResourceManager ) { | 412 | if ( mResourceManager ) { |
413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
414 | mResourceView->updateView(); | 414 | mResourceView->updateView(); |
415 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 415 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
416 | SLOT( updateView() ) ); | 416 | SLOT( updateView() ) ); |
417 | } else { | 417 | } else { |
418 | mResourceView = 0; | 418 | mResourceView = 0; |
419 | } | 419 | } |
420 | #endif | 420 | #endif |
421 | QWidget *rightBox = new QWidget( mPanner ); | 421 | QWidget *rightBox = new QWidget( mPanner ); |
422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 422 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
423 | 423 | ||
424 | mRightFrame = new QWidgetStack( rightBox ); | 424 | mRightFrame = new QWidgetStack( rightBox ); |
425 | rightLayout->addWidget( mRightFrame, 1 ); | 425 | rightLayout->addWidget( mRightFrame, 1 ); |
426 | 426 | ||
427 | mLeftFrame = mLeftSplitter; | 427 | mLeftFrame = mLeftSplitter; |
428 | #else | 428 | #else |
429 | //QWidget *mainBox = new QWidget( this ); | 429 | //QWidget *mainBox = new QWidget( this ); |
430 | //QWidget *leftFrame = new QWidget( mainBox ); | 430 | //QWidget *leftFrame = new QWidget( mainBox ); |
431 | //QBoxLayout * mainBoxLayout; | 431 | //QBoxLayout * mainBoxLayout; |
432 | if ( KOPrefs::instance()->mVerticalScreen ) { | 432 | if ( KOPrefs::instance()->mVerticalScreen ) { |
433 | //mainBoxLayout = new QVBoxLayout(mainBox); | 433 | //mainBoxLayout = new QVBoxLayout(mainBox); |
434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 434 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
@@ -4626,130 +4626,130 @@ void CalendarView::lookForOutgoingMessages() | |||
4626 | { | 4626 | { |
4627 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 4627 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
4628 | ogd->loadMessages(); | 4628 | ogd->loadMessages(); |
4629 | } | 4629 | } |
4630 | 4630 | ||
4631 | void CalendarView::lookForIncomingMessages() | 4631 | void CalendarView::lookForIncomingMessages() |
4632 | { | 4632 | { |
4633 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 4633 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
4634 | icd->retrieve(); | 4634 | icd->retrieve(); |
4635 | } | 4635 | } |
4636 | 4636 | ||
4637 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 4637 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
4638 | { | 4638 | { |
4639 | bool deleteTodo = true; | 4639 | bool deleteTodo = true; |
4640 | QPtrList<Incidence> subTodos; | 4640 | QPtrList<Incidence> subTodos; |
4641 | Incidence *aTodo; | 4641 | Incidence *aTodo; |
4642 | subTodos = t->relations(); | 4642 | subTodos = t->relations(); |
4643 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 4643 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
4644 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 4644 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
4645 | deleteTodo = false; | 4645 | deleteTodo = false; |
4646 | } | 4646 | } |
4647 | if ( deleteTodo ) { | 4647 | if ( deleteTodo ) { |
4648 | if ( t->isCompleted() && !t->doesRecur()) { | 4648 | if ( t->isCompleted() && !t->doesRecur()) { |
4649 | checkExternalId( t ); | 4649 | checkExternalId( t ); |
4650 | mCalendar->deleteTodo( t ); | 4650 | mCalendar->deleteTodo( t ); |
4651 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 4651 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
4652 | } | 4652 | } |
4653 | else | 4653 | else |
4654 | deleteTodo = false; | 4654 | deleteTodo = false; |
4655 | } | 4655 | } |
4656 | return deleteTodo; | 4656 | return deleteTodo; |
4657 | 4657 | ||
4658 | } | 4658 | } |
4659 | void CalendarView::purgeCompleted() | 4659 | void CalendarView::purgeCompleted() |
4660 | { | 4660 | { |
4661 | int result = KMessageBox::warningContinueCancel(this, | 4661 | int result = KMessageBox::warningContinueCancel(this, |
4662 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); | 4662 | i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); |
4663 | 4663 | ||
4664 | if (result == KMessageBox::Continue) { | 4664 | if (result == KMessageBox::Continue) { |
4665 | 4665 | ||
4666 | QPtrList<Todo> todoCal; | 4666 | QPtrList<Todo> todoCal; |
4667 | QPtrList<Todo> rootTodos; | 4667 | QPtrList<Todo> rootTodos; |
4668 | //QPtrList<Incidence> rel; | 4668 | //QPtrList<Incidence> rel; |
4669 | Todo *aTodo; | 4669 | Todo *aTodo; |
4670 | todoCal = calendar()->todos(); | 4670 | todoCal = calendar()->todos(); |
4671 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 4671 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
4672 | if ( !aTodo->relatedTo() ) | 4672 | if ( !aTodo->relatedTo() ) |
4673 | rootTodos.append( aTodo ); | 4673 | rootTodos.append( aTodo ); |
4674 | } | 4674 | } |
4675 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 4675 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
4676 | removeCompletedSubTodos( aTodo ); | 4676 | removeCompletedSubTodos( aTodo ); |
4677 | } | 4677 | } |
4678 | 4678 | ||
4679 | updateView(); | 4679 | updateView(); |
4680 | } | 4680 | } |
4681 | } | 4681 | } |
4682 | 4682 | ||
4683 | void CalendarView::slotCalendarChanged() | 4683 | void CalendarView::slotCalendarChanged() |
4684 | { | 4684 | { |
4685 | ; | 4685 | ; |
4686 | } | 4686 | } |
4687 | 4687 | ||
4688 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 4688 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
4689 | { | 4689 | { |
4690 | //qDebug(" alendarView::keyPressEvent "); | 4690 | //qDebug("CalendarView::keyPressEvent "); |
4691 | e->ignore(); | 4691 | e->ignore(); |
4692 | } | 4692 | } |
4693 | 4693 | ||
4694 | 4694 | ||
4695 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 4695 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
4696 | { | 4696 | { |
4697 | 4697 | ||
4698 | if ( manager != mSyncManager) | 4698 | if ( manager != mSyncManager) |
4699 | qDebug("KO: Internal error-1. SyncManager mismatch "); | 4699 | qDebug("KO: Internal error-1. SyncManager mismatch "); |
4700 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 4700 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
4701 | qDebug("KO: SyncKDE request detected!"); | 4701 | qDebug("KO: SyncKDE request detected!"); |
4702 | } | 4702 | } |
4703 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4703 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4704 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4704 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4705 | return syncCalendar( filename, mode ); | 4705 | return syncCalendar( filename, mode ); |
4706 | } | 4706 | } |
4707 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 4707 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
4708 | { | 4708 | { |
4709 | //mSyncManager = manager; | 4709 | //mSyncManager = manager; |
4710 | if ( manager != mSyncManager) | 4710 | if ( manager != mSyncManager) |
4711 | qDebug("KO: Internal error-2. SyncManager mismatch "); | 4711 | qDebug("KO: Internal error-2. SyncManager mismatch "); |
4712 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 4712 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
4713 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 4713 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
4714 | if ( resource == "sharp" ) | 4714 | if ( resource == "sharp" ) |
4715 | syncExternal( 0 ); | 4715 | syncExternal( 0 ); |
4716 | if ( resource == "phone" ) | 4716 | if ( resource == "phone" ) |
4717 | syncExternal( 1 ); | 4717 | syncExternal( 1 ); |
4718 | // pending setmodified | 4718 | // pending setmodified |
4719 | return true; | 4719 | return true; |
4720 | } | 4720 | } |
4721 | void CalendarView::setSyncManager(KSyncManager* manager) | 4721 | void CalendarView::setSyncManager(KSyncManager* manager) |
4722 | { | 4722 | { |
4723 | mSyncManager = manager; | 4723 | mSyncManager = manager; |
4724 | } | 4724 | } |
4725 | 4725 | ||
4726 | void CalendarView::removeSyncInfo( QString syncProfile) | 4726 | void CalendarView::removeSyncInfo( QString syncProfile) |
4727 | { | 4727 | { |
4728 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 4728 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
4729 | mCalendar->removeSyncInfo( syncProfile ); | 4729 | mCalendar->removeSyncInfo( syncProfile ); |
4730 | 4730 | ||
4731 | } | 4731 | } |
4732 | 4732 | ||
4733 | void CalendarView::undo_delete() | 4733 | void CalendarView::undo_delete() |
4734 | { | 4734 | { |
4735 | //qDebug("undo_delete() "); | 4735 | //qDebug("undo_delete() "); |
4736 | Incidence* undo = mCalendar->undoIncidence(); | 4736 | Incidence* undo = mCalendar->undoIncidence(); |
4737 | if ( !undo ) { | 4737 | if ( !undo ) { |
4738 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 4738 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
4739 | i18n("KO/Pi")); | 4739 | i18n("KO/Pi")); |
4740 | return; | 4740 | return; |
4741 | } | 4741 | } |
4742 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + | 4742 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + |
4743 | i18n("\nAre you sure you want\nto restore this?"), | 4743 | i18n("\nAre you sure you want\nto restore this?"), |
4744 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 4744 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
4745 | mCalendar->undoDeleteIncidence(); | 4745 | mCalendar->undoDeleteIncidence(); |
4746 | updateView(); | 4746 | updateView(); |
4747 | } | 4747 | } |
4748 | } | 4748 | } |
4749 | 4749 | ||
4750 | void CalendarView::slotViewerClosed() | 4750 | void CalendarView::slotViewerClosed() |
4751 | { | 4751 | { |
4752 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | 4752 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); |
4753 | } | 4753 | } |
4754 | 4754 | ||
4755 | void CalendarView::resetFocus() | 4755 | void CalendarView::resetFocus() |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index add1819..94f35e6 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -371,285 +371,291 @@ void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | |||
371 | if (item) { | 371 | if (item) { |
372 | DndFactory factory( mCalendar ); | 372 | DndFactory factory( mCalendar ); |
373 | ICalDrag *vd = factory.createDrag( | 373 | ICalDrag *vd = factory.createDrag( |
374 | ((KOTodoViewItem *)item)->todo(),viewport()); | 374 | ((KOTodoViewItem *)item)->todo(),viewport()); |
375 | internalDrop = false; | 375 | internalDrop = false; |
376 | // we cannot do any senseful here, because the DnD is still broken in Qt | 376 | // we cannot do any senseful here, because the DnD is still broken in Qt |
377 | if (vd->drag()) { | 377 | if (vd->drag()) { |
378 | if ( !internalDrop ) { | 378 | if ( !internalDrop ) { |
379 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 379 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
380 | qDebug("Dnd: External move: Delete drag source "); | 380 | qDebug("Dnd: External move: Delete drag source "); |
381 | } else | 381 | } else |
382 | qDebug("Dnd: Internal move "); | 382 | qDebug("Dnd: Internal move "); |
383 | 383 | ||
384 | } else { | 384 | } else { |
385 | if ( !internalDrop ) { | 385 | if ( !internalDrop ) { |
386 | qDebug("Dnd: External Copy"); | 386 | qDebug("Dnd: External Copy"); |
387 | } else | 387 | } else |
388 | qDebug("DnD: Internal copy: Copy pending"); | 388 | qDebug("DnD: Internal copy: Copy pending"); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | } | 393 | } |
394 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 394 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
395 | { | 395 | { |
396 | if ( !e->isAutoRepeat() ) { | 396 | if ( !e->isAutoRepeat() ) { |
397 | mFlagKeyPressed = false; | 397 | mFlagKeyPressed = false; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 402 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
403 | { | 403 | { |
404 | qApp->processEvents(); | 404 | qApp->processEvents(); |
405 | if ( !isVisible() ) { | 405 | if ( !isVisible() ) { |
406 | e->ignore(); | 406 | e->ignore(); |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 409 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
410 | e->ignore(); | 410 | e->ignore(); |
411 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 411 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
412 | return; | 412 | return; |
413 | } | 413 | } |
414 | if (! e->isAutoRepeat() ) | 414 | if (! e->isAutoRepeat() ) |
415 | mFlagKeyPressed = true; | 415 | mFlagKeyPressed = true; |
416 | QListViewItem* cn; | 416 | QListViewItem* cn; |
417 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 417 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
418 | cn = currentItem(); | 418 | cn = currentItem(); |
419 | if ( cn ) { | 419 | if ( cn ) { |
420 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 420 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
421 | if ( ci ){ | 421 | if ( ci ){ |
422 | if ( e->state() == ShiftButton ) | 422 | if ( e->state() == ShiftButton ) |
423 | ci->setOn( false ); | 423 | ci->setOn( false ); |
424 | else | 424 | else |
425 | ci->setOn( true ); | 425 | ci->setOn( true ); |
426 | cn = cn->itemBelow(); | 426 | cn = cn->itemBelow(); |
427 | if ( cn ) { | 427 | if ( cn ) { |
428 | setCurrentItem ( cn ); | 428 | setCurrentItem ( cn ); |
429 | ensureItemVisible ( cn ); | 429 | ensureItemVisible ( cn ); |
430 | } | 430 | } |
431 | 431 | ||
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | e->accept(); | ||
435 | return; | 436 | return; |
436 | } | 437 | } |
437 | 438 | ||
438 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 439 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
439 | switch ( e->key() ) { | 440 | switch ( e->key() ) { |
440 | case Qt::Key_Down: | 441 | case Qt::Key_Down: |
441 | case Qt::Key_Up: | 442 | case Qt::Key_Up: |
442 | QListView::keyPressEvent ( e ); | 443 | QListView::keyPressEvent ( e ); |
444 | e->accept(); | ||
443 | break; | 445 | break; |
444 | case Qt::Key_Left: | 446 | case Qt::Key_Left: |
445 | case Qt::Key_Right: | 447 | case Qt::Key_Right: |
446 | QListView::keyPressEvent ( e ); | 448 | QListView::keyPressEvent ( e ); |
447 | e->accept(); | 449 | e->accept(); |
448 | return; | 450 | return; |
449 | break; | 451 | break; |
450 | default: | 452 | default: |
451 | e->ignore(); | 453 | e->ignore(); |
452 | break; | 454 | break; |
453 | } | 455 | } |
454 | return; | 456 | return; |
455 | } | 457 | } |
456 | e->ignore(); | 458 | e->ignore(); |
457 | } | 459 | } |
458 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 460 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
459 | { | 461 | { |
460 | QListView::contentsMouseReleaseEvent(e); | 462 | QListView::contentsMouseReleaseEvent(e); |
461 | mMousePressed = false; | 463 | mMousePressed = false; |
462 | } | 464 | } |
463 | 465 | ||
464 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 466 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
465 | { | 467 | { |
466 | if (!e) return; | 468 | if (!e) return; |
467 | 469 | ||
468 | QPoint vp = contentsToViewport(e->pos()); | 470 | QPoint vp = contentsToViewport(e->pos()); |
469 | 471 | ||
470 | QListViewItem *item = itemAt(vp); | 472 | QListViewItem *item = itemAt(vp); |
471 | 473 | ||
472 | emit double_Clicked(item); | 474 | emit double_Clicked(item); |
473 | if (!item) return; | 475 | if (!item) return; |
474 | 476 | ||
475 | emit doubleClicked(item,vp,0); | 477 | emit doubleClicked(item,vp,0); |
476 | } | 478 | } |
477 | 479 | ||
478 | ///////////////////////////////////////////////////////////////////////////// | 480 | ///////////////////////////////////////////////////////////////////////////// |
479 | 481 | ||
480 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 482 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
481 | QLineEdit(parent) | 483 | QLineEdit(parent) |
482 | { | 484 | { |
483 | setText(i18n("Click to add new Todo")); | 485 | setText(i18n("Click to add new Todo")); |
484 | } | 486 | } |
485 | 487 | ||
486 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 488 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
487 | { | 489 | { |
488 | if ( text()==i18n("Click to add new Todo") ) | 490 | if ( text()==i18n("Click to add new Todo") ) |
489 | setText(""); | 491 | setText(""); |
490 | QLineEdit::focusInEvent(ev); | 492 | QLineEdit::focusInEvent(ev); |
491 | } | 493 | } |
492 | 494 | ||
493 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 495 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
494 | { | 496 | { |
495 | setText(i18n("Click to add new Todo")); | 497 | setText(i18n("Click to add new Todo")); |
496 | QLineEdit::focusOutEvent(ev); | 498 | QLineEdit::focusOutEvent(ev); |
497 | } | 499 | } |
498 | 500 | ||
499 | ///////////////////////////////////////////////////////////////////////////// | 501 | ///////////////////////////////////////////////////////////////////////////// |
500 | 502 | ||
501 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 503 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
502 | KOrg::BaseView(calendar,parent,name) | 504 | KOrg::BaseView(calendar,parent,name) |
503 | { | 505 | { |
504 | mCategoryPopupMenu = 0; | 506 | mCategoryPopupMenu = 0; |
505 | mPendingUpdateBeforeRepaint = false; | 507 | mPendingUpdateBeforeRepaint = false; |
506 | isFlatDisplay = false; | 508 | isFlatDisplay = false; |
507 | mNavigator = 0; | 509 | mNavigator = 0; |
508 | QBoxLayout *topLayout = new QVBoxLayout(this); | 510 | QBoxLayout *topLayout = new QVBoxLayout(this); |
509 | mName = QString ( name ); | 511 | mName = QString ( name ); |
510 | mBlockUpdate = false; | 512 | mBlockUpdate = false; |
511 | mQuickBar = new QWidget( this ); | 513 | mQuickBar = new QWidget( this ); |
512 | topLayout->addWidget(mQuickBar); | 514 | topLayout->addWidget(mQuickBar); |
513 | 515 | ||
514 | mQuickAdd = new KOQuickTodo(mQuickBar); | 516 | mQuickAdd = new KOQuickTodo(mQuickBar); |
515 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 517 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
516 | quickLayout->addWidget( mQuickAdd ); | 518 | quickLayout->addWidget( mQuickAdd ); |
519 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | ||
520 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | ||
521 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | ||
522 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | ||
523 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | ||
517 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 524 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
525 | |||
518 | int fixwid = flat->sizeHint().height(); | 526 | int fixwid = flat->sizeHint().height(); |
519 | if ( QApplication::desktop()->width() >= 800 ) | 527 | if ( QApplication::desktop()->width() >= 800 ) |
520 | fixwid *= 2; | 528 | fixwid *= 2; |
521 | flat->setFixedWidth( fixwid ); | 529 | flat->setFixedWidth( fixwid ); |
522 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 530 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
523 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | ||
524 | allopen->setFixedWidth( fixwid ); | 531 | allopen->setFixedWidth( fixwid ); |
525 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 532 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
526 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | ||
527 | allclose->setFixedWidth( fixwid ); | 533 | allclose->setFixedWidth( fixwid ); |
528 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 534 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
529 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | ||
530 | s_done->setPixmap( SmallIcon("greenhook16")); | 535 | s_done->setPixmap( SmallIcon("greenhook16")); |
531 | s_done->setFixedWidth( fixwid ); | 536 | s_done->setFixedWidth( fixwid ); |
532 | s_done->setFixedHeight( flat->sizeHint().height() ); | 537 | s_done->setFixedHeight( flat->sizeHint().height() ); |
533 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | 538 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); |
534 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | ||
535 | s_run->setPixmap( SmallIcon("ko16old")); | 539 | s_run->setPixmap( SmallIcon("ko16old")); |
536 | s_run->setFixedWidth( fixwid ); | 540 | s_run->setFixedWidth( fixwid ); |
537 | s_run->setFixedHeight( flat->sizeHint().height() ); | 541 | s_run->setFixedHeight( flat->sizeHint().height() ); |
538 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | 542 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); |
539 | 543 | ||
540 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | ||
541 | mNewSubBut->setFixedWidth( fixwid*3/2 ); | 544 | mNewSubBut->setFixedWidth( fixwid*3/2 ); |
542 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | 545 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); |
543 | mNewSubBut->setEnabled( false ); | 546 | mNewSubBut->setEnabled( false ); |
544 | quickLayout->addWidget( mNewSubBut ); | 547 | quickLayout->addWidget( mNewSubBut ); |
545 | quickLayout->addWidget( s_done ); | 548 | quickLayout->addWidget( s_done ); |
546 | quickLayout->addWidget( s_run ); | 549 | quickLayout->addWidget( s_run ); |
547 | 550 | ||
548 | quickLayout->addWidget( allopen ); | 551 | quickLayout->addWidget( allopen ); |
549 | quickLayout->addWidget( allclose ); | 552 | quickLayout->addWidget( allclose ); |
550 | quickLayout->addWidget( flat ); | 553 | quickLayout->addWidget( flat ); |
551 | 554 | ||
552 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 555 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
553 | 556 | ||
554 | mTodoListView = new KOTodoListView(calendar,this, name ); | 557 | mTodoListView = new KOTodoListView(calendar,this, name ); |
555 | topLayout->addWidget(mTodoListView); | 558 | topLayout->addWidget(mTodoListView); |
556 | //mTodoListView->header()->setMaximumHeight(30); | 559 | //mTodoListView->header()->setMaximumHeight(30); |
557 | mTodoListView->setRootIsDecorated(true); | 560 | mTodoListView->setRootIsDecorated(true); |
558 | mTodoListView->setAllColumnsShowFocus(true); | 561 | mTodoListView->setAllColumnsShowFocus(true); |
559 | 562 | ||
560 | mTodoListView->setShowSortIndicator(true); | 563 | mTodoListView->setShowSortIndicator(true); |
561 | 564 | ||
562 | mTodoListView->addColumn(i18n("Todo")); | 565 | mTodoListView->addColumn(i18n("Todo")); |
563 | mTodoListView->addColumn(i18n("Prio")); | 566 | mTodoListView->addColumn(i18n("Prio")); |
564 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 567 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
565 | mTodoListView->addColumn(i18n("Complete")); | 568 | mTodoListView->addColumn(i18n("Complete")); |
566 | mTodoListView->setColumnAlignment(2,AlignCenter); | 569 | mTodoListView->setColumnAlignment(2,AlignCenter); |
567 | 570 | ||
568 | mTodoListView->addColumn(i18n("Due Date")); | 571 | mTodoListView->addColumn(i18n("Due Date")); |
569 | mTodoListView->setColumnAlignment(3,AlignLeft); | 572 | mTodoListView->setColumnAlignment(3,AlignLeft); |
570 | mTodoListView->addColumn(i18n("Due Time")); | 573 | mTodoListView->addColumn(i18n("Due Time")); |
571 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 574 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
572 | 575 | ||
573 | mTodoListView->addColumn(i18n("Start Date")); | 576 | mTodoListView->addColumn(i18n("Start Date")); |
574 | mTodoListView->setColumnAlignment(5,AlignLeft); | 577 | mTodoListView->setColumnAlignment(5,AlignLeft); |
575 | mTodoListView->addColumn(i18n("Start Time")); | 578 | mTodoListView->addColumn(i18n("Start Time")); |
576 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 579 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
577 | 580 | ||
578 | mTodoListView->addColumn(i18n("Cancelled")); | 581 | //mTodoListView->addColumn(i18n("Cancelled")); |
579 | mTodoListView->addColumn(i18n("Categories")); | 582 | mTodoListView->addColumn(i18n("Categories")); |
580 | mTodoListView->addColumn(i18n("Calendar")); | 583 | mTodoListView->addColumn(i18n("Calendar")); |
584 | mTodoListView->addColumn(i18n("Last Modified")); | ||
585 | mTodoListView->addColumn(i18n("Created")); | ||
586 | mTodoListView->addColumn(i18n("Last Modified Sub")); | ||
581 | #if 0 | 587 | #if 0 |
582 | mTodoListView->addColumn(i18n("Sort Id")); | 588 | mTodoListView->addColumn(i18n("Sort Id")); |
583 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 589 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
584 | #endif | 590 | #endif |
585 | 591 | ||
586 | mTodoListView->setMinimumHeight( 60 ); | 592 | mTodoListView->setMinimumHeight( 60 ); |
587 | mTodoListView->setItemsRenameable( true ); | 593 | mTodoListView->setItemsRenameable( true ); |
588 | mTodoListView->setRenameable( 0 ); | 594 | mTodoListView->setRenameable( 0 ); |
589 | mTodoListView->setColumnWidth( 0, 120 ); | 595 | mTodoListView->setColumnWidth( 0, 120 ); |
590 | int iii = 0; | 596 | int iii = 0; |
591 | for ( iii = 0; iii< 10 ; ++iii ) | 597 | for ( iii = 0; iii< 12 ; ++iii ) |
592 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 598 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); |
593 | 599 | ||
594 | 600 | ||
595 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 601 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
596 | 602 | ||
597 | mPriorityPopupMenu = new QPopupMenu(this); | 603 | mPriorityPopupMenu = new QPopupMenu(this); |
598 | for (int i = 1; i <= 5; i++) { | 604 | for (int i = 1; i <= 5; i++) { |
599 | QString label = QString ("%1").arg (i); | 605 | QString label = QString ("%1").arg (i); |
600 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 606 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
601 | } | 607 | } |
602 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 608 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
603 | 609 | ||
604 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 610 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
605 | for (int i = 0; i <= 100; i+=20) { | 611 | for (int i = 0; i <= 100; i+=20) { |
606 | QString label = QString ("%1 %").arg (i); | 612 | QString label = QString ("%1 %").arg (i); |
607 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 613 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
608 | } | 614 | } |
609 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 615 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
610 | 616 | ||
611 | 617 | ||
612 | mCategoryPopupMenu = new QPopupMenu (this); | 618 | mCategoryPopupMenu = new QPopupMenu (this); |
613 | mCategoryPopupMenu->setCheckable (true); | 619 | mCategoryPopupMenu->setCheckable (true); |
614 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 620 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
615 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | 621 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); |
616 | 622 | ||
617 | mCalPopupMenu = new QPopupMenu (this); | 623 | mCalPopupMenu = new QPopupMenu (this); |
618 | mCalPopupMenu->setCheckable (true); | 624 | mCalPopupMenu->setCheckable (true); |
619 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | 625 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); |
620 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | 626 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); |
621 | 627 | ||
622 | 628 | ||
623 | 629 | ||
624 | 630 | ||
625 | mItemPopupMenu = new QPopupMenu(this); | 631 | mItemPopupMenu = new QPopupMenu(this); |
626 | mItemPopupMenu->insertItem(i18n("Show"), this, | 632 | mItemPopupMenu->insertItem(i18n("Show"), this, |
627 | SLOT (showTodo())); | 633 | SLOT (showTodo())); |
628 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 634 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
629 | SLOT (editTodo())); | 635 | SLOT (editTodo())); |
630 | mItemPopupMenu->insertItem( i18n("Delete..."), this, | 636 | mItemPopupMenu->insertItem( i18n("Delete..."), this, |
631 | SLOT (deleteTodo())); | 637 | SLOT (deleteTodo())); |
632 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 638 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
633 | SLOT (cloneTodo())); | 639 | SLOT (cloneTodo())); |
634 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 640 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
635 | SLOT (moveTodo())); | 641 | SLOT (moveTodo())); |
636 | #ifndef DESKTOP_VERSION | 642 | #ifndef DESKTOP_VERSION |
637 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 643 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
638 | SLOT (beamTodo())); | 644 | SLOT (beamTodo())); |
639 | #endif | 645 | #endif |
640 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 646 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
641 | SLOT (cancelTodo())); | 647 | SLOT (cancelTodo())); |
642 | mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); | 648 | mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); |
643 | mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); | 649 | mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); |
644 | mItemPopupMenu->insertSeparator(); | 650 | mItemPopupMenu->insertSeparator(); |
645 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 651 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
646 | SLOT (toggleRunningItem())); | 652 | SLOT (toggleRunningItem())); |
647 | mItemPopupMenu->insertSeparator(); | 653 | mItemPopupMenu->insertSeparator(); |
648 | /* | 654 | /* |
649 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 655 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
650 | SLOT (newTodo())); | 656 | SLOT (newTodo())); |
651 | */ | 657 | */ |
652 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 658 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
653 | SLOT (newSubTodo())); | 659 | SLOT (newSubTodo())); |
654 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 660 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
655 | SLOT (unparentTodo()),0,21); | 661 | SLOT (unparentTodo()),0,21); |
@@ -1542,137 +1548,137 @@ void KOTodoView::toggleQuickTodo() | |||
1542 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1548 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1543 | } | 1549 | } |
1544 | 1550 | ||
1545 | void KOTodoView::toggleRunning() | 1551 | void KOTodoView::toggleRunning() |
1546 | { | 1552 | { |
1547 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1553 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1548 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1554 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1549 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1555 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1550 | updateView(); | 1556 | updateView(); |
1551 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 1557 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
1552 | topLevelWidget()->setCaption(i18n("Hide not Running")); | 1558 | topLevelWidget()->setCaption(i18n("Hide not Running")); |
1553 | else | 1559 | else |
1554 | topLevelWidget()->setCaption(i18n("Show not Running")); | 1560 | topLevelWidget()->setCaption(i18n("Show not Running")); |
1555 | } | 1561 | } |
1556 | 1562 | ||
1557 | void KOTodoView::toggleCompleted() | 1563 | void KOTodoView::toggleCompleted() |
1558 | { | 1564 | { |
1559 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1565 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1560 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1566 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1561 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1567 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1562 | updateView(); | 1568 | updateView(); |
1563 | if ( KOPrefs::instance()->mShowCompletedTodo ) | 1569 | if ( KOPrefs::instance()->mShowCompletedTodo ) |
1564 | topLevelWidget()->setCaption(i18n("Show Completed")); | 1570 | topLevelWidget()->setCaption(i18n("Show Completed")); |
1565 | else | 1571 | else |
1566 | topLevelWidget()->setCaption(i18n("Hide Completed")); | 1572 | topLevelWidget()->setCaption(i18n("Hide Completed")); |
1567 | } | 1573 | } |
1568 | 1574 | ||
1569 | void KOTodoView::addQuickTodo() | 1575 | void KOTodoView::addQuickTodo() |
1570 | { | 1576 | { |
1571 | addQuickTodoPar( 0 ); | 1577 | addQuickTodoPar( 0 ); |
1572 | } | 1578 | } |
1573 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) | 1579 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) |
1574 | { | 1580 | { |
1575 | Todo *todo = new Todo(); | 1581 | Todo *todo = new Todo(); |
1576 | todo->setSummary(mQuickAdd->text()); | 1582 | todo->setSummary(mQuickAdd->text()); |
1577 | todo->setOrganizer(KOPrefs::instance()->email()); | 1583 | todo->setOrganizer(KOPrefs::instance()->email()); |
1578 | if ( parentTodo ) { | 1584 | if ( parentTodo ) { |
1579 | todo->setRelatedTo(parentTodo); | 1585 | todo->setRelatedTo(parentTodo); |
1580 | 1586 | ||
1581 | todo->setCategories (parentTodo->categoriesStr ()); | 1587 | todo->setCategories (parentTodo->categoriesStr ()); |
1582 | todo->setSecrecy (parentTodo->secrecy ()); | 1588 | todo->setSecrecy (parentTodo->secrecy ()); |
1583 | if ( parentTodo->priority() < 3 ) | 1589 | if ( parentTodo->priority() < 3 ) |
1584 | todo->setPriority( parentTodo->priority() ); | 1590 | todo->setPriority( parentTodo->priority() ); |
1585 | todo->setCalID( parentTodo->calID() ); | 1591 | todo->setCalID( parentTodo->calID() ); |
1586 | } else { | 1592 | } else { |
1587 | CalFilter * cf = mCalendar->filter(); | 1593 | CalFilter * cf = mCalendar->filter(); |
1588 | if ( cf ) { | 1594 | if ( cf ) { |
1589 | if ( cf->isEnabled()&& cf->showCategories()) { | 1595 | if ( cf->isEnabled()&& cf->showCategories()) { |
1590 | todo->setCategories(cf->categoryList()); | 1596 | todo->setCategories(cf->categoryList()); |
1591 | } | 1597 | } |
1592 | if ( cf->isEnabled() ) | 1598 | if ( cf->isEnabled() ) |
1593 | todo->setSecrecy( cf->getSecrecy()); | 1599 | todo->setSecrecy( cf->getSecrecy()); |
1594 | } | 1600 | } |
1595 | } | 1601 | } |
1596 | mCalendar->addTodo(todo); | 1602 | mCalendar->addTodo(todo); |
1597 | mQuickAdd->setText(""); | 1603 | mQuickAdd->setText(""); |
1598 | todoModified (todo, KOGlobals::EVENTADDED ); | 1604 | todoModified (todo, KOGlobals::EVENTADDED ); |
1599 | updateView(); | 1605 | updateView(); |
1600 | 1606 | ||
1601 | } | 1607 | } |
1602 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1608 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1603 | { | 1609 | { |
1604 | // e->ignore(); | 1610 | // e->ignore(); |
1605 | //return; | 1611 | //return; |
1606 | //qDebug("KOTodoView::keyPressEvent "); | ||
1607 | if ( !isVisible() ) { | 1612 | if ( !isVisible() ) { |
1608 | e->ignore(); | 1613 | e->ignore(); |
1609 | return; | 1614 | return; |
1610 | } | 1615 | } |
1611 | switch ( e->key() ) { | 1616 | switch ( e->key() ) { |
1612 | case Qt::Key_Down: | 1617 | case Qt::Key_Down: |
1613 | case Qt::Key_Up: | 1618 | case Qt::Key_Up: |
1614 | QWidget::keyPressEvent ( e ); | 1619 | // KOrg::BaseView::keyPressEvent ( e ); |
1620 | e->ignore(); | ||
1615 | break; | 1621 | break; |
1616 | 1622 | ||
1617 | case Qt::Key_Q: | 1623 | case Qt::Key_Q: |
1618 | 1624 | ||
1619 | 1625 | ||
1620 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { | 1626 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) { |
1621 | e->ignore(); | 1627 | e->ignore(); |
1622 | break; | 1628 | break; |
1623 | } | 1629 | } |
1624 | toggleQuickTodo(); | 1630 | toggleQuickTodo(); |
1625 | break; | 1631 | break; |
1626 | case Qt::Key_U: | 1632 | case Qt::Key_U: |
1627 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1633 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1628 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1634 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1629 | unparentTodo(); | 1635 | unparentTodo(); |
1630 | e->accept(); | 1636 | e->accept(); |
1631 | } else | 1637 | } else |
1632 | e->ignore(); | 1638 | e->ignore(); |
1633 | break; | 1639 | break; |
1634 | case Qt::Key_S: | 1640 | case Qt::Key_S: |
1635 | if ( e->state() == Qt::ControlButton ) { | 1641 | if ( e->state() == Qt::ControlButton ) { |
1636 | e->ignore(); | 1642 | e->ignore(); |
1637 | break; | 1643 | break; |
1638 | } | 1644 | } |
1639 | if ( e->state() == Qt::ShiftButton ) { | 1645 | if ( e->state() == Qt::ShiftButton ) { |
1640 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1646 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1641 | reparentTodo(); | 1647 | reparentTodo(); |
1642 | e->accept(); | 1648 | e->accept(); |
1643 | } else | 1649 | } else |
1644 | e->ignore(); | 1650 | e->ignore(); |
1645 | break; | 1651 | break; |
1646 | case Qt::Key_P: | 1652 | case Qt::Key_P: |
1647 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1653 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1648 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1654 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1649 | if ( pendingSubtodo ) | 1655 | if ( pendingSubtodo ) |
1650 | itemClicked(mActiveItem); | 1656 | itemClicked(mActiveItem); |
1651 | e->accept(); | 1657 | e->accept(); |
1652 | } else | 1658 | } else |
1653 | e->ignore(); | 1659 | e->ignore(); |
1654 | break; | 1660 | break; |
1655 | case Qt::Key_Escape: | 1661 | case Qt::Key_Escape: |
1656 | if ( pendingSubtodo ) { | 1662 | if ( pendingSubtodo ) { |
1657 | itemClicked(0); | 1663 | itemClicked(0); |
1658 | e->accept(); | 1664 | e->accept(); |
1659 | } else | 1665 | } else |
1660 | e->ignore(); | 1666 | e->ignore(); |
1661 | break; | 1667 | break; |
1662 | default: | 1668 | default: |
1663 | e->ignore(); | 1669 | e->ignore(); |
1664 | } | 1670 | } |
1665 | 1671 | ||
1666 | if ( true ) { | 1672 | if ( true ) { |
1667 | if ( e->key() == Qt::Key_I ) { | 1673 | if ( e->key() == Qt::Key_I ) { |
1668 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1674 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1669 | if ( cn ) { | 1675 | if ( cn ) { |
1670 | mActiveItem = cn; | 1676 | mActiveItem = cn; |
1671 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1677 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1672 | if ( ci ){ | 1678 | if ( ci ){ |
1673 | showTodo(); | 1679 | showTodo(); |
1674 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1680 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1675 | if ( cn ) { | 1681 | if ( cn ) { |
1676 | mTodoListView->setCurrentItem ( cn ); | 1682 | mTodoListView->setCurrentItem ( cn ); |
1677 | mTodoListView->ensureItemVisible ( cn ); | 1683 | mTodoListView->ensureItemVisible ( cn ); |
1678 | } | 1684 | } |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 0cf6e4c..bdef94c 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -92,132 +92,148 @@ void KOTodoViewItem::construct() | |||
92 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 92 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
93 | } | 93 | } |
94 | else { | 94 | else { |
95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
96 | else setSortKey(2,QString::number(99)); | 96 | else setSortKey(2,QString::number(99)); |
97 | } | 97 | } |
98 | if (mTodo->hasDueDate()) { | 98 | if (mTodo->hasDueDate()) { |
99 | setText(3, mTodo->dtDueDateStr()); | 99 | setText(3, mTodo->dtDueDateStr()); |
100 | QDate d = mTodo->dtDue().date(); | 100 | QDate d = mTodo->dtDue().date(); |
101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
102 | // setSortKey(3,keyd); | 102 | // setSortKey(3,keyd); |
103 | if (mTodo->doesFloat()) { | 103 | if (mTodo->doesFloat()) { |
104 | setText(4,""); | 104 | setText(4,""); |
105 | } | 105 | } |
106 | else { | 106 | else { |
107 | setText(4,mTodo->dtDueTimeStr()); | 107 | setText(4,mTodo->dtDueTimeStr()); |
108 | QTime t = mTodo->dtDue().time(); | 108 | QTime t = mTodo->dtDue().time(); |
109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
110 | //setSortKey(4,keyt); | 110 | //setSortKey(4,keyt); |
111 | } | 111 | } |
112 | } else { | 112 | } else { |
113 | setText(3,""); | 113 | setText(3,""); |
114 | setText(4,""); | 114 | setText(4,""); |
115 | } | 115 | } |
116 | setSortKey(3,keyd); | 116 | setSortKey(3,keyd); |
117 | setSortKey(4,keyt); | 117 | setSortKey(4,keyt); |
118 | 118 | ||
119 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); | 119 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); |
120 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 120 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | keyd = ""; | 124 | keyd = ""; |
125 | keyt = ""; | 125 | keyt = ""; |
126 | 126 | ||
127 | if (mTodo->isRunning() ) { | 127 | if (mTodo->isRunning() ) { |
128 | QDate d = mTodo->runStart().date(); | 128 | QDate d = mTodo->runStart().date(); |
129 | QTime t = mTodo->runStart().time(); | 129 | QTime t = mTodo->runStart().time(); |
130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
132 | keyd = KGlobal::locale()->formatDate( d , true); | 132 | keyd = KGlobal::locale()->formatDate( d , true); |
133 | keyt = KGlobal::locale()->formatTime( t ); | 133 | keyt = KGlobal::locale()->formatTime( t ); |
134 | 134 | ||
135 | } else { | 135 | } else { |
136 | 136 | ||
137 | if (mTodo->hasStartDate()) { | 137 | if (mTodo->hasStartDate()) { |
138 | keyd = mTodo->dtStartDateStr(); | 138 | keyd = mTodo->dtStartDateStr(); |
139 | QDate d = mTodo->dtStart().date(); | 139 | QDate d = mTodo->dtStart().date(); |
140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
141 | 141 | ||
142 | if ( !mTodo->doesFloat()) { | 142 | if ( !mTodo->doesFloat()) { |
143 | keyt = mTodo->dtStartTimeStr(); | 143 | keyt = mTodo->dtStartTimeStr(); |
144 | QTime t = mTodo->dtStart().time(); | 144 | QTime t = mTodo->dtStart().time(); |
145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | } | 149 | } |
150 | } | 150 | } |
151 | setText(5,keyd); | 151 | setText(5,keyd); |
152 | setText(6,keyt); | 152 | setText(6,keyt); |
153 | setSortKey(5,skeyd); | 153 | setSortKey(5,skeyd); |
154 | setSortKey(6,skeyt); | 154 | setSortKey(6,skeyt); |
155 | 155 | ||
156 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); | 156 | //setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); |
157 | setText(8,mTodo->categoriesStr()); | 157 | setText(7,mTodo->categoriesStr()); |
158 | setText(9,KOPrefs::instance()->calName( mTodo->calID())); | 158 | setText(8,KOPrefs::instance()->calName( mTodo->calID())); |
159 | 159 | setText(9, KGlobal::locale()->formatDateTime( mTodo->lastModified(), true, true )); | |
160 | setText(10, KGlobal::locale()->formatDateTime( mTodo->created(), true, true )); | ||
161 | setText(11, KGlobal::locale()->formatDateTime( mTodo->lastModifiedSub(), true, true )); | ||
162 | QString key; | ||
163 | QDate d = mTodo->lastModified().date(); | ||
164 | QTime t = mTodo->lastModified().time(); | ||
165 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | ||
166 | setSortKey(9,key); | ||
167 | d = mTodo->created().date(); | ||
168 | t = mTodo->created().time(); | ||
169 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | ||
170 | setSortKey(10,key); | ||
171 | d = mTodo->lastModifiedSub().date(); | ||
172 | t = mTodo->lastModifiedSub().time(); | ||
173 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | ||
174 | setSortKey(11,key); | ||
175 | |||
160 | #if 0 | 176 | #if 0 |
161 | // Find sort id in description. It's the text behind the last '#' character | 177 | // Find sort id in description. It's the text behind the last '#' character |
162 | // found in the description. White spaces are removed from beginning and end | 178 | // found in the description. White spaces are removed from beginning and end |
163 | // of sort id. | 179 | // of sort id. |
164 | int pos = mTodo->description().findRev('#'); | 180 | int pos = mTodo->description().findRev('#'); |
165 | if (pos < 0) { | 181 | if (pos < 0) { |
166 | setText(6,""); | 182 | setText(6,""); |
167 | } else { | 183 | } else { |
168 | QString str = mTodo->description().mid(pos+1); | 184 | QString str = mTodo->description().mid(pos+1); |
169 | str.stripWhiteSpace(); | 185 | str.stripWhiteSpace(); |
170 | setText(6,str); | 186 | setText(6,str); |
171 | } | 187 | } |
172 | #endif | 188 | #endif |
173 | 189 | ||
174 | m_known = false; | 190 | m_known = false; |
175 | m_init = false; | 191 | m_init = false; |
176 | 192 | ||
177 | setMyPixmap(); | 193 | setMyPixmap(); |
178 | 194 | ||
179 | } | 195 | } |
180 | void KOTodoViewItem::setMyPixmap() | 196 | void KOTodoViewItem::setMyPixmap() |
181 | { | 197 | { |
182 | int size = 5; | 198 | int size = 5; |
183 | QPixmap pixi = QPixmap( 1, 1 ); | 199 | QPixmap pixi = QPixmap( 1, 1 ); |
184 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 200 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
185 | // pixi = SmallIcon("redcross16"); | 201 | // pixi = SmallIcon("redcross16"); |
186 | // } else { | 202 | // } else { |
187 | QPainter p; | 203 | QPainter p; |
188 | 204 | ||
189 | int pixSize = 0; | 205 | int pixSize = 0; |
190 | QPixmap pPix = QPixmap( size, size ); | 206 | QPixmap pPix = QPixmap( size, size ); |
191 | if ( mTodo->description().length() > 0 ) { | 207 | if ( mTodo->description().length() > 0 ) { |
192 | pixi.resize(size, pixSize+size); | 208 | pixi.resize(size, pixSize+size); |
193 | pPix.fill( Qt::darkGreen ); | 209 | pPix.fill( Qt::darkGreen ); |
194 | p.begin( &pixi ); | 210 | p.begin( &pixi ); |
195 | p. drawPixmap ( 0, pixSize, pPix); | 211 | p. drawPixmap ( 0, pixSize, pPix); |
196 | p.end(); | 212 | p.end(); |
197 | pixSize += size; | 213 | pixSize += size; |
198 | } | 214 | } |
199 | if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) { | 215 | if ( mTodo->isAlarmEnabled() && mTodo->alarmEnabled()) { |
200 | pixi.resize(size, pixSize+size); | 216 | pixi.resize(size, pixSize+size); |
201 | pPix.fill( Qt::red ); | 217 | pPix.fill( Qt::red ); |
202 | p.begin( &pixi ); | 218 | p.begin( &pixi ); |
203 | p. drawPixmap ( 0, pixSize, pPix); | 219 | p. drawPixmap ( 0, pixSize, pPix); |
204 | p.end(); | 220 | p.end(); |
205 | pixSize += size; | 221 | pixSize += size; |
206 | } | 222 | } |
207 | if ( mTodo->doesRecur() ) { | 223 | if ( mTodo->doesRecur() ) { |
208 | pixi.resize(size, pixSize+size); | 224 | pixi.resize(size, pixSize+size); |
209 | pPix.fill( Qt::blue ); | 225 | pPix.fill( Qt::blue ); |
210 | p.begin( &pixi ); | 226 | p.begin( &pixi ); |
211 | p. drawPixmap ( 0, pixSize, pPix); | 227 | p. drawPixmap ( 0, pixSize, pPix); |
212 | p.end(); | 228 | p.end(); |
213 | pixSize += size; | 229 | pixSize += size; |
214 | } | 230 | } |
215 | // } | 231 | // } |
216 | if ( pixi.width() > 1 ) { | 232 | if ( pixi.width() > 1 ) { |
217 | setPixmap ( 0,pixi ) ; | 233 | setPixmap ( 0,pixi ) ; |
218 | } else { | 234 | } else { |
219 | setPixmap ( 0,QPixmap() ) ; | 235 | setPixmap ( 0,QPixmap() ) ; |
220 | } | 236 | } |
221 | } | 237 | } |
222 | void KOTodoViewItem::stateChange(bool state) | 238 | void KOTodoViewItem::stateChange(bool state) |
223 | { | 239 | { |
@@ -256,165 +272,199 @@ void KOTodoViewItem::stateChange(bool state) | |||
256 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 272 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
257 | setSortKey(3,keyd); | 273 | setSortKey(3,keyd); |
258 | if (mTodo->doesFloat()) { | 274 | if (mTodo->doesFloat()) { |
259 | setText(4,""); | 275 | setText(4,""); |
260 | } | 276 | } |
261 | else { | 277 | else { |
262 | setText(4,mTodo->dtDueTimeStr()); | 278 | setText(4,mTodo->dtDueTimeStr()); |
263 | QTime t = mTodo->dtDue().time(); | 279 | QTime t = mTodo->dtDue().time(); |
264 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 280 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
265 | setSortKey(4,keyt); | 281 | setSortKey(4,keyt); |
266 | } | 282 | } |
267 | } | 283 | } |
268 | if (mTodo->hasStartDate()) { | 284 | if (mTodo->hasStartDate()) { |
269 | QString skeyt = "=="; | 285 | QString skeyt = "=="; |
270 | QString skeyd = "=="; | 286 | QString skeyd = "=="; |
271 | setText(5, mTodo->dtStartDateStr()); | 287 | setText(5, mTodo->dtStartDateStr()); |
272 | QDate d = mTodo->dtStart().date(); | 288 | QDate d = mTodo->dtStart().date(); |
273 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 289 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
274 | 290 | ||
275 | if (mTodo->doesFloat()) { | 291 | if (mTodo->doesFloat()) { |
276 | setText(6,""); | 292 | setText(6,""); |
277 | } | 293 | } |
278 | else { | 294 | else { |
279 | setText(6,mTodo->dtStartTimeStr()); | 295 | setText(6,mTodo->dtStartTimeStr()); |
280 | QTime t = mTodo->dtStart().time(); | 296 | QTime t = mTodo->dtStart().time(); |
281 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 297 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
282 | 298 | ||
283 | } | 299 | } |
284 | setSortKey(5,skeyd); | 300 | setSortKey(5,skeyd); |
285 | setSortKey(6,skeyt); | 301 | setSortKey(6,skeyt); |
286 | } | 302 | } |
287 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 303 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
288 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 304 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
289 | 305 | ||
290 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 306 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
291 | if (mTodo->percentComplete()<100) { | 307 | if (mTodo->percentComplete()<100) { |
292 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 308 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
293 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 309 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
294 | } | 310 | } |
295 | else { | 311 | else { |
296 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 312 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
297 | else setSortKey(2,QString::number(99)); | 313 | else setSortKey(2,QString::number(99)); |
298 | } | 314 | } |
299 | if ( state ) { | 315 | if ( state ) { |
300 | QListViewItem * myChild = firstChild(); | 316 | QListViewItem * myChild = firstChild(); |
301 | KOTodoViewItem *item; | 317 | KOTodoViewItem *item; |
302 | while( myChild ) { | 318 | while( myChild ) { |
303 | //qDebug("stateCH "); | 319 | //qDebug("stateCH "); |
304 | item = static_cast<KOTodoViewItem*>(myChild); | 320 | item = static_cast<KOTodoViewItem*>(myChild); |
305 | item->stateChange(state); | 321 | item->stateChange(state); |
306 | myChild = myChild->nextSibling(); | 322 | myChild = myChild->nextSibling(); |
307 | } | 323 | } |
308 | } else { | 324 | } else { |
309 | QListViewItem * myChild = parent(); | 325 | QListViewItem * myChild = parent(); |
310 | if ( myChild ) | 326 | if ( myChild ) |
311 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 327 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
312 | } | 328 | } |
313 | mTodoView->modified(true); | 329 | mTodoView->modified(true); |
314 | setMyPixmap(); | 330 | setMyPixmap(); |
315 | mTodoView->setTodoModified( mTodo ); | 331 | mTodoView->setTodoModified( mTodo ); |
316 | } | 332 | } |
317 | 333 | ||
318 | bool KOTodoViewItem::isAlternate() | 334 | bool KOTodoViewItem::isAlternate() |
319 | { | 335 | { |
320 | 336 | #if 0 | |
337 | //if ( m_known ) return m_odd; | ||
338 | //qDebug("test "); | ||
339 | KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove()); | ||
340 | if ( item ) { | ||
341 | m_known = item->m_known; | ||
342 | if ( m_known ) { | ||
343 | m_odd = !item->m_odd ; | ||
344 | return m_odd; | ||
345 | } | ||
346 | } else { | ||
347 | item = static_cast<KOTodoViewItem *>(itemBelow()); | ||
348 | if ( item ) { | ||
349 | m_known = item->m_known; | ||
350 | if ( m_known ) { | ||
351 | m_odd = !item->m_odd ; | ||
352 | return m_odd; | ||
353 | } | ||
354 | } | ||
355 | } | ||
321 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 356 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
322 | if (lv && lv->alternateBackground().isValid()) | 357 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
358 | bool previous = true; | ||
359 | qDebug("WHILE "); | ||
360 | while ( item ) { | ||
361 | item->m_odd = !previous; | ||
362 | item->m_known = true; | ||
363 | previous = !previous; | ||
364 | item = static_cast<KOTodoViewItem *>(item->itemBelow()); | ||
365 | } | ||
366 | return m_odd; | ||
367 | |||
368 | #else | ||
369 | |||
370 | //KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | ||
371 | //if (lv && lv->alternateBackground().isValid()) | ||
323 | { | 372 | { |
324 | KOTodoViewItem *above = 0; | 373 | KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove()); |
325 | above = static_cast<KOTodoViewItem *>(itemAbove()); | ||
326 | m_known = above ? above->m_known : true; | 374 | m_known = above ? above->m_known : true; |
327 | if (m_known) | 375 | if (m_known) |
328 | { | 376 | { |
329 | m_odd = above ? !above->m_odd : false; | 377 | m_odd = above ? !above->m_odd : false; |
330 | } | 378 | } |
331 | else | 379 | else |
332 | { | 380 | { |
333 | KOTodoViewItem *item; | 381 | KOTodoViewItem *item; |
334 | bool previous = true; | 382 | bool previous = true; |
335 | if (QListViewItem::parent()) | 383 | if (QListViewItem::parent()) |
336 | { | 384 | { |
337 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); | 385 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); |
338 | if (item) | 386 | if (item) |
339 | previous = item->m_odd; | 387 | previous = item->m_odd; |
340 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 388 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
341 | } | 389 | } |
342 | else | 390 | else |
343 | { | 391 | { |
392 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | ||
344 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); | 393 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
345 | } | 394 | } |
346 | 395 | ||
347 | while(item) | 396 | while(item) |
348 | { | 397 | { |
349 | item->m_odd = previous = !previous; | 398 | item->m_odd = previous = !previous; |
350 | item->m_known = true; | 399 | item->m_known = true; |
351 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); | 400 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); |
352 | } | 401 | } |
353 | } | 402 | } |
354 | return m_odd; | 403 | return m_odd; |
355 | } | 404 | } |
356 | return false; | 405 | return false; |
406 | #endif | ||
357 | } | 407 | } |
358 | 408 | ||
359 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 409 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
360 | { | 410 | { |
361 | QColorGroup _cg = cg; | 411 | QColorGroup _cg = cg; |
362 | QColorGroup::ColorRole role; | 412 | QColorGroup::ColorRole role; |
363 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) | 413 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) |
364 | role = QColorGroup::Text; | 414 | role = QColorGroup::Text; |
365 | else | 415 | else |
366 | role = QColorGroup::Base; | 416 | role = QColorGroup::Base; |
367 | //#ifndef KORG_NOLVALTERNATION | 417 | //#ifndef KORG_NOLVALTERNATION |
368 | if (isAlternate()) | 418 | if (isAlternate()) |
369 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 419 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
370 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 420 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
371 | QColor colorToSet; | 421 | QColor colorToSet; |
372 | if ( column == 0 && mTodo->calID() > 1 ) { | 422 | if ( column == 0 && mTodo->calID() > 1 ) { |
373 | setColor = true; | 423 | setColor = true; |
374 | colorToSet = KOPrefs::instance()->defaultColor( mTodo->calID() ); | 424 | colorToSet = KOPrefs::instance()->defaultColor( mTodo->calID() ); |
375 | } else if ( setColor ) { | 425 | } else if ( setColor ) { |
376 | QStringList categories = mTodo->categories(); | 426 | QStringList categories = mTodo->categories(); |
377 | QString cat = categories.first(); | 427 | QString cat = categories.first(); |
378 | if ( !cat.isEmpty()) { | 428 | if ( !cat.isEmpty()) { |
379 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 429 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
380 | } else | 430 | } else |
381 | setColor = false; | 431 | setColor = false; |
382 | } | 432 | } |
383 | bool openMode = !isOpen(); | 433 | bool openMode = !isOpen(); |
384 | // maybe we are in flat-display-mode | 434 | // maybe we are in flat-display-mode |
385 | if ( !firstChild() ) | 435 | if ( !firstChild() ) |
386 | openMode = false; | 436 | openMode = false; |
387 | bool colorRunning = mTodo->isRunning(); | 437 | bool colorRunning = mTodo->isRunning(); |
388 | if ( ! colorRunning && openMode ) | 438 | if ( ! colorRunning && openMode ) |
389 | colorRunning = mTodo->hasRunningSub(); | 439 | colorRunning = mTodo->hasRunningSub(); |
390 | if ( colorRunning ) { | 440 | if ( colorRunning ) { |
391 | setColor = true; | 441 | setColor = true; |
392 | colorToSet = KOPrefs::instance()->mTodoRunColor; | 442 | colorToSet = KOPrefs::instance()->mTodoRunColor; |
393 | } else { | 443 | } else { |
394 | int odue = mTodo->hasDueSubTodo( openMode ); | 444 | int odue = mTodo->hasDueSubTodo( openMode ); |
395 | if (odue == 2) { | 445 | if (odue == 2) { |
396 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 446 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
397 | setColor = true; | 447 | setColor = true; |
398 | } else if ( odue == 1 ) { | 448 | } else if ( odue == 1 ) { |
399 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 449 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
400 | setColor = true; | 450 | setColor = true; |
401 | } | 451 | } |
402 | } | 452 | } |
403 | 453 | ||
404 | 454 | ||
405 | if ( setColor ) { | 455 | if ( setColor ) { |
406 | _cg.setColor(role,colorToSet ); | 456 | _cg.setColor(role,colorToSet ); |
407 | if ( role == QColorGroup::Base) { | 457 | if ( role == QColorGroup::Base) { |
408 | int rgb = colorToSet.red(); | 458 | int rgb = colorToSet.red(); |
409 | rgb += colorToSet.blue()/2; | 459 | rgb += colorToSet.blue()/2; |
410 | rgb += colorToSet.green(); | 460 | rgb += colorToSet.green(); |
411 | if ( rgb < 200 ) | 461 | if ( rgb < 200 ) |
412 | _cg.setColor(QColorGroup::Text,Qt::white ); | 462 | _cg.setColor(QColorGroup::Text,Qt::white ); |
413 | } | 463 | } |
414 | } | 464 | } |
415 | //#endif | 465 | //#endif |
416 | if ( column > 0 ){ | 466 | if ( column > 0 ){ |
417 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 467 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
418 | p->save(); | 468 | p->save(); |
419 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 469 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
420 | 470 | ||
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 11f7ecc..e4bcc5e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -220,129 +220,149 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
220 | // no need to compare mRelatedTo | 220 | // no need to compare mRelatedTo |
221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
222 | // i1.relations() == i2.relations() && | 222 | // i1.relations() == i2.relations() && |
223 | i1.exDates() == i2.exDates() && | 223 | i1.exDates() == i2.exDates() && |
224 | i1.attachments() == i2.attachments() && | 224 | i1.attachments() == i2.attachments() && |
225 | i1.resources() == i2.resources() && | 225 | i1.resources() == i2.resources() && |
226 | i1.secrecy() == i2.secrecy() && | 226 | i1.secrecy() == i2.secrecy() && |
227 | i1.priority() == i2.priority() && | 227 | i1.priority() == i2.priority() && |
228 | i1.cancelled() == i2.cancelled() && | 228 | i1.cancelled() == i2.cancelled() && |
229 | stringCompare( i1.location(), i2.location() ); | 229 | stringCompare( i1.location(), i2.location() ); |
230 | } | 230 | } |
231 | 231 | ||
232 | Incidence* Incidence::recreateCloneException( QDate d ) | 232 | Incidence* Incidence::recreateCloneException( QDate d ) |
233 | { | 233 | { |
234 | Incidence* newInc = clone(); | 234 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 235 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( typeID() == eventID ) { | 239 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 246 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 249 | ((Todo*)this)->setRecurDates(); |
250 | } | 250 | } |
251 | newInc->setExDates( DateList () ); | 251 | newInc->setExDates( DateList () ); |
252 | } | 252 | } |
253 | return newInc; | 253 | return newInc; |
254 | } | 254 | } |
255 | 255 | ||
256 | void Incidence::recreate() | 256 | void Incidence::recreate() |
257 | { | 257 | { |
258 | setCreated(QDateTime::currentDateTime()); | 258 | setCreated(QDateTime::currentDateTime()); |
259 | 259 | ||
260 | setUid(CalFormat::createUniqueId()); | 260 | setUid(CalFormat::createUniqueId()); |
261 | 261 | ||
262 | setRevision(0); | 262 | setRevision(0); |
263 | setIDStr( ":" ); | 263 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 264 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 265 | } |
266 | void Incidence::cloneRelations( Incidence * newInc ) | 266 | void Incidence::cloneRelations( Incidence * newInc ) |
267 | { | 267 | { |
268 | // newInc is already a clone of this incidence | 268 | // newInc is already a clone of this incidence |
269 | Incidence * inc; | 269 | Incidence * inc; |
270 | Incidence * cloneInc; | 270 | Incidence * cloneInc; |
271 | QPtrList<Incidence> Relations = relations(); | 271 | QPtrList<Incidence> Relations = relations(); |
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 272 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 273 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 274 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 275 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 276 | inc->cloneRelations( cloneInc ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 280 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
283 | } | 283 | } |
284 | 284 | void Incidence::setLastModifiedSubInvalid() | |
285 | { | ||
286 | mLastModifiedSub = QDateTime(); | ||
287 | if ( mRelatedTo ) | ||
288 | mRelatedTo->setLastModifiedSubInvalid(); | ||
289 | } | ||
290 | QDateTime Incidence::lastModifiedSub() | ||
291 | { | ||
292 | if ( !mRelations.count() ) | ||
293 | return lastModified(); | ||
294 | if ( mLastModifiedSub.isValid() ) | ||
295 | return mLastModifiedSub; | ||
296 | mLastModifiedSub = lastModified(); | ||
297 | Incidence * inc; | ||
298 | QPtrList<Incidence> Relations = relations(); | ||
299 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
300 | if ( inc->lastModifiedSub() > mLastModifiedSub ) | ||
301 | mLastModifiedSub = inc->lastModifiedSub(); | ||
302 | } | ||
303 | return mLastModifiedSub; | ||
304 | } | ||
285 | void Incidence::setCreated(QDateTime created) | 305 | void Incidence::setCreated(QDateTime created) |
286 | { | 306 | { |
287 | if (mReadOnly) return; | 307 | if (mReadOnly) return; |
288 | mCreated = getEvenTime(created); | 308 | mCreated = getEvenTime(created); |
289 | } | 309 | } |
290 | 310 | ||
291 | QDateTime Incidence::created() const | 311 | QDateTime Incidence::created() const |
292 | { | 312 | { |
293 | return mCreated; | 313 | return mCreated; |
294 | } | 314 | } |
295 | 315 | ||
296 | void Incidence::setRevision(int rev) | 316 | void Incidence::setRevision(int rev) |
297 | { | 317 | { |
298 | if (mReadOnly) return; | 318 | if (mReadOnly) return; |
299 | mRevision = rev; | 319 | mRevision = rev; |
300 | 320 | ||
301 | updated(); | 321 | updated(); |
302 | } | 322 | } |
303 | 323 | ||
304 | int Incidence::revision() const | 324 | int Incidence::revision() const |
305 | { | 325 | { |
306 | return mRevision; | 326 | return mRevision; |
307 | } | 327 | } |
308 | 328 | ||
309 | void Incidence::setDtStart(const QDateTime &dtStart) | 329 | void Incidence::setDtStart(const QDateTime &dtStart) |
310 | { | 330 | { |
311 | 331 | ||
312 | QDateTime dt = getEvenTime(dtStart); | 332 | QDateTime dt = getEvenTime(dtStart); |
313 | recurrence()->setRecurStart( dt); | 333 | recurrence()->setRecurStart( dt); |
314 | IncidenceBase::setDtStart( dt ); | 334 | IncidenceBase::setDtStart( dt ); |
315 | } | 335 | } |
316 | 336 | ||
317 | void Incidence::setDescription(const QString &description) | 337 | void Incidence::setDescription(const QString &description) |
318 | { | 338 | { |
319 | if (mReadOnly) return; | 339 | if (mReadOnly) return; |
320 | mDescription = description; | 340 | mDescription = description; |
321 | updated(); | 341 | updated(); |
322 | } | 342 | } |
323 | 343 | ||
324 | QString Incidence::description() const | 344 | QString Incidence::description() const |
325 | { | 345 | { |
326 | return mDescription; | 346 | return mDescription; |
327 | } | 347 | } |
328 | 348 | ||
329 | 349 | ||
330 | void Incidence::setSummary(const QString &summary) | 350 | void Incidence::setSummary(const QString &summary) |
331 | { | 351 | { |
332 | if (mReadOnly) return; | 352 | if (mReadOnly) return; |
333 | mSummary = summary; | 353 | mSummary = summary; |
334 | updated(); | 354 | updated(); |
335 | } | 355 | } |
336 | 356 | ||
337 | QString Incidence::summary() const | 357 | QString Incidence::summary() const |
338 | { | 358 | { |
339 | return mSummary; | 359 | return mSummary; |
340 | } | 360 | } |
341 | void Incidence::checkCategories() | 361 | void Incidence::checkCategories() |
342 | { | 362 | { |
343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 363 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 364 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 365 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
346 | } | 366 | } |
347 | 367 | ||
348 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false | 368 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
@@ -407,139 +427,139 @@ QStringList Incidence::categories() const | |||
407 | return mCategories; | 427 | return mCategories; |
408 | } | 428 | } |
409 | 429 | ||
410 | QString Incidence::categoriesStr() | 430 | QString Incidence::categoriesStr() |
411 | { | 431 | { |
412 | return mCategories.join(","); | 432 | return mCategories.join(","); |
413 | } | 433 | } |
414 | QString Incidence::categoriesStrWithSpace() | 434 | QString Incidence::categoriesStrWithSpace() |
415 | { | 435 | { |
416 | return mCategories.join(", "); | 436 | return mCategories.join(", "); |
417 | } | 437 | } |
418 | 438 | ||
419 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 439 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
420 | { | 440 | { |
421 | if (mReadOnly) return; | 441 | if (mReadOnly) return; |
422 | mRelatedToUid = relatedToUid; | 442 | mRelatedToUid = relatedToUid; |
423 | } | 443 | } |
424 | 444 | ||
425 | QString Incidence::relatedToUid() const | 445 | QString Incidence::relatedToUid() const |
426 | { | 446 | { |
427 | return mRelatedToUid; | 447 | return mRelatedToUid; |
428 | } | 448 | } |
429 | 449 | ||
430 | void Incidence::setRelatedTo(Incidence *relatedTo) | 450 | void Incidence::setRelatedTo(Incidence *relatedTo) |
431 | { | 451 | { |
432 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 452 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
433 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 453 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
434 | if (mReadOnly || mRelatedTo == relatedTo) return; | 454 | if (mReadOnly || mRelatedTo == relatedTo) return; |
435 | if(mRelatedTo) { | 455 | if(mRelatedTo) { |
436 | // updated(); | 456 | // updated(); |
437 | mRelatedTo->removeRelation(this); | 457 | mRelatedTo->removeRelation(this); |
438 | } | 458 | } |
439 | mRelatedTo = relatedTo; | 459 | mRelatedTo = relatedTo; |
440 | if (mRelatedTo) { | 460 | if (mRelatedTo) { |
441 | mRelatedTo->addRelation(this); | 461 | mRelatedTo->addRelation(this); |
442 | mRelatedToUid = mRelatedTo->uid(); | 462 | mRelatedToUid = mRelatedTo->uid(); |
443 | } else { | 463 | } else { |
444 | mRelatedToUid = ""; | 464 | mRelatedToUid = ""; |
445 | } | 465 | } |
446 | } | 466 | } |
447 | 467 | ||
448 | Incidence *Incidence::relatedTo() const | 468 | Incidence *Incidence::relatedTo() const |
449 | { | 469 | { |
450 | return mRelatedTo; | 470 | return mRelatedTo; |
451 | } | 471 | } |
452 | 472 | ||
453 | QPtrList<Incidence> Incidence::relations() const | 473 | QPtrList<Incidence> Incidence::relations() const |
454 | { | 474 | { |
455 | return mRelations; | 475 | return mRelations; |
456 | } | 476 | } |
457 | 477 | ||
458 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | 478 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) |
459 | { | 479 | { |
460 | Incidence* inc; | 480 | Incidence* inc; |
461 | QPtrList<Incidence> Relations = relations(); | 481 | QPtrList<Incidence> Relations = relations(); |
462 | for (inc=Relations.first();inc;inc=Relations.next()) { | 482 | for (inc=Relations.first();inc;inc=Relations.next()) { |
463 | inc->addRelationsToList( rel ); | 483 | inc->addRelationsToList( rel ); |
464 | } | 484 | } |
465 | if ( rel->findRef( this ) == -1 ) | 485 | if ( rel->findRef( this ) == -1 ) |
466 | rel->append( this ); | 486 | rel->append( this ); |
467 | } | 487 | } |
468 | 488 | ||
469 | void Incidence::addRelation(Incidence *event) | 489 | void Incidence::addRelation(Incidence *event) |
470 | { | 490 | { |
491 | setLastModifiedSubInvalid(); | ||
471 | if( mRelations.findRef( event ) == -1 ) { | 492 | if( mRelations.findRef( event ) == -1 ) { |
472 | mRelations.append(event); | 493 | mRelations.append(event); |
473 | //updated(); | 494 | //updated(); |
474 | } | 495 | } |
475 | } | 496 | } |
476 | 497 | ||
477 | void Incidence::removeRelation(Incidence *event) | 498 | void Incidence::removeRelation(Incidence *event) |
478 | { | 499 | { |
479 | 500 | setLastModifiedSubInvalid(); | |
480 | mRelations.removeRef(event); | 501 | mRelations.removeRef(event); |
481 | |||
482 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 502 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
483 | } | 503 | } |
484 | 504 | ||
485 | bool Incidence::recursOn(const QDate &qd) const | 505 | bool Incidence::recursOn(const QDate &qd) const |
486 | { | 506 | { |
487 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 507 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
488 | else return false; | 508 | else return false; |
489 | } | 509 | } |
490 | 510 | ||
491 | void Incidence::setExDates(const DateList &exDates) | 511 | void Incidence::setExDates(const DateList &exDates) |
492 | { | 512 | { |
493 | if (mReadOnly) return; | 513 | if (mReadOnly) return; |
494 | mExDates = exDates; | 514 | mExDates = exDates; |
495 | 515 | ||
496 | recurrence()->setRecurExDatesCount(mExDates.count()); | 516 | recurrence()->setRecurExDatesCount(mExDates.count()); |
497 | 517 | ||
498 | updated(); | 518 | updated(); |
499 | } | 519 | } |
500 | 520 | ||
501 | void Incidence::addExDate(const QDate &date) | 521 | void Incidence::addExDate(const QDate &date) |
502 | { | 522 | { |
503 | if (mReadOnly) return; | 523 | if (mReadOnly) return; |
504 | mExDates.append(date); | 524 | mExDates.append(date); |
505 | 525 | ||
506 | recurrence()->setRecurExDatesCount(mExDates.count()); | 526 | recurrence()->setRecurExDatesCount(mExDates.count()); |
507 | 527 | ||
508 | updated(); | 528 | updated(); |
509 | } | 529 | } |
510 | 530 | ||
511 | DateList Incidence::exDates() const | 531 | DateList Incidence::exDates() const |
512 | { | 532 | { |
513 | return mExDates; | 533 | return mExDates; |
514 | } | 534 | } |
515 | 535 | ||
516 | bool Incidence::isException(const QDate &date) const | 536 | bool Incidence::isException(const QDate &date) const |
517 | { | 537 | { |
518 | DateList::ConstIterator it; | 538 | DateList::ConstIterator it; |
519 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { | 539 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { |
520 | if ( (*it) == date ) { | 540 | if ( (*it) == date ) { |
521 | return true; | 541 | return true; |
522 | } | 542 | } |
523 | } | 543 | } |
524 | 544 | ||
525 | return false; | 545 | return false; |
526 | } | 546 | } |
527 | 547 | ||
528 | void Incidence::addAttachment(Attachment *attachment) | 548 | void Incidence::addAttachment(Attachment *attachment) |
529 | { | 549 | { |
530 | if (mReadOnly || !attachment) return; | 550 | if (mReadOnly || !attachment) return; |
531 | mAttachments.append(attachment); | 551 | mAttachments.append(attachment); |
532 | updated(); | 552 | updated(); |
533 | } | 553 | } |
534 | 554 | ||
535 | void Incidence::deleteAttachment(Attachment *attachment) | 555 | void Incidence::deleteAttachment(Attachment *attachment) |
536 | { | 556 | { |
537 | mAttachments.removeRef(attachment); | 557 | mAttachments.removeRef(attachment); |
538 | } | 558 | } |
539 | 559 | ||
540 | void Incidence::deleteAttachments(const QString& mime) | 560 | void Incidence::deleteAttachments(const QString& mime) |
541 | { | 561 | { |
542 | Attachment *at = mAttachments.first(); | 562 | Attachment *at = mAttachments.first(); |
543 | while (at) { | 563 | while (at) { |
544 | if (at->mimeType() == mime) | 564 | if (at->mimeType() == mime) |
545 | mAttachments.remove(); | 565 | mAttachments.remove(); |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index c88ba2f..d4af9f0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -216,103 +216,106 @@ class Incidence : public IncidenceBase | |||
216 | /** return human-readable name of secrecy class */ | 216 | /** return human-readable name of secrecy class */ |
217 | static QString secrecyName(int); | 217 | static QString secrecyName(int); |
218 | 218 | ||
219 | /** returns TRUE if the date specified is one on which the event will | 219 | /** returns TRUE if the date specified is one on which the event will |
220 | * recur. */ | 220 | * recur. */ |
221 | bool recursOn(const QDate &qd) const; | 221 | bool recursOn(const QDate &qd) const; |
222 | 222 | ||
223 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): | 223 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): |
224 | 224 | ||
225 | /** set resources used, such as Office, Car, etc. */ | 225 | /** set resources used, such as Office, Car, etc. */ |
226 | void setResources(const QStringList &resources); | 226 | void setResources(const QStringList &resources); |
227 | /** return list of current resources */ | 227 | /** return list of current resources */ |
228 | QStringList resources() const; | 228 | QStringList resources() const; |
229 | 229 | ||
230 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ | 230 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ |
231 | void setPriority(int priority); | 231 | void setPriority(int priority); |
232 | /** get the event's priority */ | 232 | /** get the event's priority */ |
233 | int priority() const; | 233 | int priority() const; |
234 | 234 | ||
235 | /** All alarms that are associated with this incidence */ | 235 | /** All alarms that are associated with this incidence */ |
236 | QPtrList<Alarm> alarms() const; | 236 | QPtrList<Alarm> alarms() const; |
237 | /** Create a new alarm which is associated with this incidence */ | 237 | /** Create a new alarm which is associated with this incidence */ |
238 | Alarm* newAlarm(); | 238 | Alarm* newAlarm(); |
239 | /** Add an alarm which is associated with this incidence */ | 239 | /** Add an alarm which is associated with this incidence */ |
240 | void addAlarm(Alarm*); | 240 | void addAlarm(Alarm*); |
241 | /** Remove an alarm that is associated with this incidence */ | 241 | /** Remove an alarm that is associated with this incidence */ |
242 | void removeAlarm(Alarm*); | 242 | void removeAlarm(Alarm*); |
243 | /** Remove all alarms that are associated with this incidence */ | 243 | /** Remove all alarms that are associated with this incidence */ |
244 | void clearAlarms(); | 244 | void clearAlarms(); |
245 | /** return whether any alarm associated with this incidence is enabled */ | 245 | /** return whether any alarm associated with this incidence is enabled */ |
246 | bool isAlarmEnabled() const; | 246 | bool isAlarmEnabled() const; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | Return the recurrence rule associated with this incidence. If there is | 249 | Return the recurrence rule associated with this incidence. If there is |
250 | none, returns an appropriate (non-0) object. | 250 | none, returns an appropriate (non-0) object. |
251 | */ | 251 | */ |
252 | Recurrence *recurrence() const; | 252 | Recurrence *recurrence() const; |
253 | void setRecurrence(Recurrence * r); | 253 | void setRecurrence(Recurrence * r); |
254 | /** | 254 | /** |
255 | Forward to Recurrence::doesRecur(). | 255 | Forward to Recurrence::doesRecur(). |
256 | */ | 256 | */ |
257 | ushort doesRecur() const; | 257 | ushort doesRecur() const; |
258 | 258 | ||
259 | /** set the event's/todo's location. Do _not_ use it with journal */ | 259 | /** set the event's/todo's location. Do _not_ use it with journal */ |
260 | void setLocation(const QString &location); | 260 | void setLocation(const QString &location); |
261 | /** return the event's/todo's location. Do _not_ use it with journal */ | 261 | /** return the event's/todo's location. Do _not_ use it with journal */ |
262 | QString location() const; | 262 | QString location() const; |
263 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 263 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
264 | bool hasStartDate() const; | 264 | bool hasStartDate() const; |
265 | /** sets the event's hasStartDate value. */ | 265 | /** sets the event's hasStartDate value. */ |
266 | void setHasStartDate(bool f); | 266 | void setHasStartDate(bool f); |
267 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 267 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
268 | bool cancelled() const; | 268 | bool cancelled() const; |
269 | void setCancelled( bool b ); | 269 | void setCancelled( bool b ); |
270 | 270 | ||
271 | bool hasRecurrenceID() const; | 271 | bool hasRecurrenceID() const; |
272 | void setHasRecurrenceID( bool b ); | 272 | void setHasRecurrenceID( bool b ); |
273 | 273 | ||
274 | void setRecurrenceID(QDateTime); | 274 | void setRecurrenceID(QDateTime); |
275 | QDateTime recurrenceID () const; | 275 | QDateTime recurrenceID () const; |
276 | QDateTime dtStart() const; | 276 | QDateTime dtStart() const; |
277 | bool isHoliday() const; | 277 | bool isHoliday() const; |
278 | bool isBirthday() const; | 278 | bool isBirthday() const; |
279 | bool isAnniversary() const; | 279 | bool isAnniversary() const; |
280 | QDateTime lastModifiedSub(); | ||
281 | void setLastModifiedSubInvalid(); | ||
280 | 282 | ||
281 | 283 | ||
282 | protected: | 284 | protected: |
283 | QPtrList<Alarm> mAlarms; | 285 | QPtrList<Alarm> mAlarms; |
284 | QPtrList<Incidence> mRelations; | 286 | QPtrList<Incidence> mRelations; |
285 | QDateTime mRecurrenceID; | 287 | QDateTime mRecurrenceID; |
286 | bool mHasRecurrenceID; | 288 | bool mHasRecurrenceID; |
287 | private: | 289 | private: |
288 | void checkCategories(); | 290 | void checkCategories(); |
289 | bool mHoliday, mBirthday, mAnniversary; | 291 | bool mHoliday, mBirthday, mAnniversary; |
290 | int mRevision; | 292 | int mRevision; |
291 | bool mCancelled; | 293 | bool mCancelled; |
292 | 294 | ||
293 | // base components of jounal, event and todo | 295 | // base components of jounal, event and todo |
294 | QDateTime mCreated; | 296 | QDateTime mCreated; |
297 | QDateTime mLastModifiedSub; | ||
295 | QString mDescription; | 298 | QString mDescription; |
296 | QString mSummary; | 299 | QString mSummary; |
297 | QStringList mCategories; | 300 | QStringList mCategories; |
298 | Incidence *mRelatedTo; | 301 | Incidence *mRelatedTo; |
299 | QString mRelatedToUid; | 302 | QString mRelatedToUid; |
300 | DateList mExDates; | 303 | DateList mExDates; |
301 | QPtrList<Attachment> mAttachments; | 304 | QPtrList<Attachment> mAttachments; |
302 | QStringList mResources; | 305 | QStringList mResources; |
303 | bool mHasStartDate; // if todo has associated start date | 306 | bool mHasStartDate; // if todo has associated start date |
304 | 307 | ||
305 | int mSecrecy; | 308 | int mSecrecy; |
306 | int mPriority; // 1 = highest, 2 = less, etc. | 309 | int mPriority; // 1 = highest, 2 = less, etc. |
307 | 310 | ||
308 | //QPtrList<Alarm> mAlarms; | 311 | //QPtrList<Alarm> mAlarms; |
309 | Recurrence *mRecurrence; | 312 | Recurrence *mRecurrence; |
310 | 313 | ||
311 | QString mLocation; | 314 | QString mLocation; |
312 | }; | 315 | }; |
313 | 316 | ||
314 | bool operator==( const Incidence&, const Incidence& ); | 317 | bool operator==( const Incidence&, const Incidence& ); |
315 | 318 | ||
316 | } | 319 | } |
317 | 320 | ||
318 | #endif | 321 | #endif |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -130,135 +130,139 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | |||
130 | // of much use. We are not comparing for identity, after all. | 130 | // of much use. We are not comparing for identity, after all. |
131 | i1.doesFloat() == i2.doesFloat() && | 131 | i1.doesFloat() == i2.doesFloat() && |
132 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 132 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
133 | // no need to compare mObserver | 133 | // no need to compare mObserver |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) | 137 | QDateTime IncidenceBase::getEvenTime( QDateTime dt ) |
138 | { | 138 | { |
139 | QTime t = dt.time(); | 139 | QTime t = dt.time(); |
140 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 140 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
141 | return dt; | 141 | return dt; |
142 | } | 142 | } |
143 | 143 | ||
144 | bool IncidenceBase::isTagged() const | 144 | bool IncidenceBase::isTagged() const |
145 | { | 145 | { |
146 | return mIsTagged; | 146 | return mIsTagged; |
147 | } | 147 | } |
148 | void IncidenceBase::setTagged( bool b) | 148 | void IncidenceBase::setTagged( bool b) |
149 | { | 149 | { |
150 | mIsTagged = b; | 150 | mIsTagged = b; |
151 | } | 151 | } |
152 | void IncidenceBase::setCalID( int id ) | 152 | void IncidenceBase::setCalID( int id ) |
153 | { | 153 | { |
154 | if ( mCalID > 0 ) { | 154 | if ( mCalID > 0 ) { |
155 | blockLastModified = true; | 155 | blockLastModified = true; |
156 | updated(); | 156 | updated(); |
157 | blockLastModified = false; | 157 | blockLastModified = false; |
158 | } | 158 | } |
159 | mCalID = id; | 159 | mCalID = id; |
160 | } | 160 | } |
161 | int IncidenceBase::calID() const | 161 | int IncidenceBase::calID() const |
162 | { | 162 | { |
163 | return mCalID; | 163 | return mCalID; |
164 | } | 164 | } |
165 | void IncidenceBase::setCalEnabled( bool b ) | 165 | void IncidenceBase::setCalEnabled( bool b ) |
166 | { | 166 | { |
167 | mCalEnabled = b; | 167 | mCalEnabled = b; |
168 | } | 168 | } |
169 | bool IncidenceBase::calEnabled() const | 169 | bool IncidenceBase::calEnabled() const |
170 | { | 170 | { |
171 | return mCalEnabled; | 171 | return mCalEnabled; |
172 | } | 172 | } |
173 | 173 | ||
174 | void IncidenceBase::setAlarmEnabled( bool b ) | 174 | void IncidenceBase::setAlarmEnabled( bool b ) |
175 | { | 175 | { |
176 | mAlarmEnabled = b; | 176 | mAlarmEnabled = b; |
177 | } | 177 | } |
178 | bool IncidenceBase::alarmEnabled() const | 178 | bool IncidenceBase::alarmEnabled() const |
179 | { | 179 | { |
180 | return mAlarmEnabled; | 180 | return mAlarmEnabled; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void IncidenceBase::setUid(const QString &uid) | 184 | void IncidenceBase::setUid(const QString &uid) |
185 | { | 185 | { |
186 | mUid = uid; | 186 | mUid = uid; |
187 | updated(); | 187 | updated(); |
188 | } | 188 | } |
189 | 189 | ||
190 | QString IncidenceBase::uid() const | 190 | QString IncidenceBase::uid() const |
191 | { | 191 | { |
192 | return mUid; | 192 | return mUid; |
193 | } | 193 | } |
194 | void IncidenceBase::setLastModifiedSubInvalid() | ||
195 | { | ||
194 | 196 | ||
197 | } | ||
195 | void IncidenceBase::setLastModified(const QDateTime &lm) | 198 | void IncidenceBase::setLastModified(const QDateTime &lm) |
196 | { | 199 | { |
197 | if ( blockLastModified ) return; | 200 | if ( blockLastModified ) return; |
198 | // DON'T! updated() because we call this from | 201 | // DON'T! updated() because we call this from |
199 | // Calendar::updateEvent(). | 202 | // Calendar::updateEvent(). |
200 | mLastModified = getEvenTime(lm); | 203 | mLastModified = getEvenTime(lm); |
204 | setLastModifiedSubInvalid(); | ||
201 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 205 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
202 | } | 206 | } |
203 | 207 | ||
204 | QDateTime IncidenceBase::lastModified() const | 208 | QDateTime IncidenceBase::lastModified() const |
205 | { | 209 | { |
206 | return mLastModified; | 210 | return mLastModified; |
207 | } | 211 | } |
208 | 212 | ||
209 | void IncidenceBase::setOrganizer(const QString &o) | 213 | void IncidenceBase::setOrganizer(const QString &o) |
210 | { | 214 | { |
211 | // we don't check for readonly here, because it is | 215 | // we don't check for readonly here, because it is |
212 | // possible that by setting the organizer we are changing | 216 | // possible that by setting the organizer we are changing |
213 | // the event's readonly status... | 217 | // the event's readonly status... |
214 | mOrganizer = o; | 218 | mOrganizer = o; |
215 | if (mOrganizer.left(7).upper() == "MAILTO:") | 219 | if (mOrganizer.left(7).upper() == "MAILTO:") |
216 | mOrganizer = mOrganizer.remove(0,7); | 220 | mOrganizer = mOrganizer.remove(0,7); |
217 | 221 | ||
218 | updated(); | 222 | updated(); |
219 | } | 223 | } |
220 | 224 | ||
221 | QString IncidenceBase::organizer() const | 225 | QString IncidenceBase::organizer() const |
222 | { | 226 | { |
223 | return mOrganizer; | 227 | return mOrganizer; |
224 | } | 228 | } |
225 | 229 | ||
226 | void IncidenceBase::setReadOnly( bool readOnly ) | 230 | void IncidenceBase::setReadOnly( bool readOnly ) |
227 | { | 231 | { |
228 | mReadOnly = readOnly; | 232 | mReadOnly = readOnly; |
229 | } | 233 | } |
230 | 234 | ||
231 | void IncidenceBase::setDtStart(const QDateTime &dtStart) | 235 | void IncidenceBase::setDtStart(const QDateTime &dtStart) |
232 | { | 236 | { |
233 | // if (mReadOnly) return; | 237 | // if (mReadOnly) return; |
234 | mDtStart = getEvenTime(dtStart); | 238 | mDtStart = getEvenTime(dtStart); |
235 | updated(); | 239 | updated(); |
236 | } | 240 | } |
237 | 241 | ||
238 | 242 | ||
239 | QDateTime IncidenceBase::dtStart() const | 243 | QDateTime IncidenceBase::dtStart() const |
240 | { | 244 | { |
241 | return mDtStart; | 245 | return mDtStart; |
242 | } | 246 | } |
243 | 247 | ||
244 | QString IncidenceBase::dtStartTimeStr() const | 248 | QString IncidenceBase::dtStartTimeStr() const |
245 | { | 249 | { |
246 | return KGlobal::locale()->formatTime(dtStart().time()); | 250 | return KGlobal::locale()->formatTime(dtStart().time()); |
247 | } | 251 | } |
248 | 252 | ||
249 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const | 253 | QString IncidenceBase::dtStartDateStr(bool shortfmt) const |
250 | { | 254 | { |
251 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); | 255 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); |
252 | } | 256 | } |
253 | 257 | ||
254 | QString IncidenceBase::dtStartStr(bool shortfmt) const | 258 | QString IncidenceBase::dtStartStr(bool shortfmt) const |
255 | { | 259 | { |
256 | if ( doesFloat() ) | 260 | if ( doesFloat() ) |
257 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); | 261 | return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); |
258 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); | 262 | return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); |
259 | } | 263 | } |
260 | 264 | ||
261 | 265 | ||
262 | bool IncidenceBase::doesFloat() const | 266 | bool IncidenceBase::doesFloat() const |
263 | { | 267 | { |
264 | return mFloats; | 268 | return mFloats; |
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index bed73db..665c1f6 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -88,99 +88,100 @@ class IncidenceBase : public CustomProperties | |||
88 | QString dtStartStr(bool shortfmt=true) const; | 88 | QString dtStartStr(bool shortfmt=true) const; |
89 | 89 | ||
90 | virtual void setDuration(int seconds); | 90 | virtual void setDuration(int seconds); |
91 | int duration() const; | 91 | int duration() const; |
92 | void setHasDuration(bool); | 92 | void setHasDuration(bool); |
93 | bool hasDuration() const; | 93 | bool hasDuration() const; |
94 | 94 | ||
95 | /** Return true or false depending on whether the incidence "floats," | 95 | /** Return true or false depending on whether the incidence "floats," |
96 | * i.e. has a date but no time attached to it. */ | 96 | * i.e. has a date but no time attached to it. */ |
97 | bool doesFloat() const; | 97 | bool doesFloat() const; |
98 | /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ | 98 | /** Set whether the incidence floats, i.e. has a date but no time attached to it. */ |
99 | void setFloats(bool f); | 99 | void setFloats(bool f); |
100 | 100 | ||
101 | /** | 101 | /** |
102 | Add Attendee to this incidence. IncidenceBase takes ownership of the | 102 | Add Attendee to this incidence. IncidenceBase takes ownership of the |
103 | Attendee object. | 103 | Attendee object. |
104 | */ | 104 | */ |
105 | bool addAttendee(Attendee *a, bool doupdate=true ); | 105 | bool addAttendee(Attendee *a, bool doupdate=true ); |
106 | // void removeAttendee(Attendee *a); | 106 | // void removeAttendee(Attendee *a); |
107 | // void removeAttendee(const char *n); | 107 | // void removeAttendee(const char *n); |
108 | /** Remove all Attendees. */ | 108 | /** Remove all Attendees. */ |
109 | void clearAttendees(); | 109 | void clearAttendees(); |
110 | /** Return list of attendees. */ | 110 | /** Return list of attendees. */ |
111 | QPtrList<Attendee> attendees() const { return mAttendees; }; | 111 | QPtrList<Attendee> attendees() const { return mAttendees; }; |
112 | /** Return number of attendees. */ | 112 | /** Return number of attendees. */ |
113 | int attendeeCount() const { return mAttendees.count(); }; | 113 | int attendeeCount() const { return mAttendees.count(); }; |
114 | /** Return the Attendee with this email */ | 114 | /** Return the Attendee with this email */ |
115 | Attendee* attendeeByMail(const QString &); | 115 | Attendee* attendeeByMail(const QString &); |
116 | /** Return first Attendee with one of this emails */ | 116 | /** Return first Attendee with one of this emails */ |
117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); | 117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); |
118 | 118 | ||
119 | /** pilot syncronization states */ | 119 | /** pilot syncronization states */ |
120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; | 120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; |
121 | /** Set synchronisation satus. */ | 121 | /** Set synchronisation satus. */ |
122 | void setSyncStatus(int stat); | 122 | void setSyncStatus(int stat); |
123 | /** Return synchronisation status. */ | 123 | /** Return synchronisation status. */ |
124 | int syncStatus() const; | 124 | int syncStatus() const; |
125 | 125 | ||
126 | /** Set Pilot Id. */ | 126 | /** Set Pilot Id. */ |
127 | void setPilotId(int id); | 127 | void setPilotId(int id); |
128 | /** Return Pilot Id. */ | 128 | /** Return Pilot Id. */ |
129 | int pilotId() const; | 129 | int pilotId() const; |
130 | 130 | ||
131 | void setTempSyncStat(int id); | 131 | void setTempSyncStat(int id); |
132 | int tempSyncStat() const; | 132 | int tempSyncStat() const; |
133 | void setIDStr( const QString & ); | 133 | void setIDStr( const QString & ); |
134 | QString IDStr() const; | 134 | QString IDStr() const; |
135 | void setID( const QString &, const QString & ); | 135 | void setID( const QString &, const QString & ); |
136 | QString getID( const QString & ); | 136 | QString getID( const QString & ); |
137 | void setCsum( const QString &, const QString & ); | 137 | void setCsum( const QString &, const QString & ); |
138 | QString getCsum( const QString & ); | 138 | QString getCsum( const QString & ); |
139 | void removeID(const QString &); | 139 | void removeID(const QString &); |
140 | 140 | ||
141 | void registerObserver( Observer * ); | 141 | void registerObserver( Observer * ); |
142 | void unRegisterObserver( Observer * ); | 142 | void unRegisterObserver( Observer * ); |
143 | void updated(); | 143 | void updated(); |
144 | void setCalID( int id ); | 144 | void setCalID( int id ); |
145 | int calID() const; | 145 | int calID() const; |
146 | void setCalEnabled( bool ); | 146 | void setCalEnabled( bool ); |
147 | bool calEnabled() const; | 147 | bool calEnabled() const; |
148 | void setAlarmEnabled( bool ); | 148 | void setAlarmEnabled( bool ); |
149 | bool alarmEnabled() const; | 149 | bool alarmEnabled() const; |
150 | bool isTagged() const; | 150 | bool isTagged() const; |
151 | void setTagged( bool ); | 151 | void setTagged( bool ); |
152 | virtual void setLastModifiedSubInvalid(); | ||
152 | protected: | 153 | protected: |
153 | bool blockLastModified; | 154 | bool blockLastModified; |
154 | bool mIsTagged; | 155 | bool mIsTagged; |
155 | QDateTime mDtStart; | 156 | QDateTime mDtStart; |
156 | bool mReadOnly; | 157 | bool mReadOnly; |
157 | QDateTime getEvenTime( QDateTime ); | 158 | QDateTime getEvenTime( QDateTime ); |
158 | 159 | ||
159 | private: | 160 | private: |
160 | // base components | 161 | // base components |
161 | QString mOrganizer; | 162 | QString mOrganizer; |
162 | QString mUid; | 163 | QString mUid; |
163 | int mCalID; | 164 | int mCalID; |
164 | bool mCalEnabled; | 165 | bool mCalEnabled; |
165 | bool mAlarmEnabled; | 166 | bool mAlarmEnabled; |
166 | QDateTime mLastModified; | 167 | QDateTime mLastModified; |
167 | QPtrList<Attendee> mAttendees; | 168 | QPtrList<Attendee> mAttendees; |
168 | 169 | ||
169 | bool mFloats; | 170 | bool mFloats; |
170 | 171 | ||
171 | int mDuration; | 172 | int mDuration; |
172 | bool mHasDuration; | 173 | bool mHasDuration; |
173 | QString mExternalId; | 174 | QString mExternalId; |
174 | int mTempSyncStat; | 175 | int mTempSyncStat; |
175 | 176 | ||
176 | // PILOT SYNCHRONIZATION STUFF | 177 | // PILOT SYNCHRONIZATION STUFF |
177 | int mPilotId; // unique id for pilot sync | 178 | int mPilotId; // unique id for pilot sync |
178 | int mSyncStatus; // status (for sync) | 179 | int mSyncStatus; // status (for sync) |
179 | 180 | ||
180 | QPtrList<Observer> mObservers; | 181 | QPtrList<Observer> mObservers; |
181 | }; | 182 | }; |
182 | 183 | ||
183 | bool operator==( const IncidenceBase&, const IncidenceBase& ); | 184 | bool operator==( const IncidenceBase&, const IncidenceBase& ); |
184 | } | 185 | } |
185 | 186 | ||
186 | #endif | 187 | #endif |
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index 5d83511..7f352d6 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp | |||
@@ -415,74 +415,75 @@ KDatePicker::sizeHint() const | |||
415 | if ( cx > QApplication::desktop()->width() -5 ) | 415 | if ( cx > QApplication::desktop()->width() -5 ) |
416 | cx = QApplication::desktop()->width() -5; | 416 | cx = QApplication::desktop()->width() -5; |
417 | // ----- calculate height hint: | 417 | // ----- calculate height hint: |
418 | cy+=tableSize.height()+lineDate->sizeHint().height(); | 418 | cy+=tableSize.height()+lineDate->sizeHint().height(); |
419 | 419 | ||
420 | return QSize(cx, cy); | 420 | return QSize(cx, cy); |
421 | } | 421 | } |
422 | 422 | ||
423 | void | 423 | void |
424 | KDatePicker::setFontSize(int s) | 424 | KDatePicker::setFontSize(int s) |
425 | { | 425 | { |
426 | QWidget *buttons[]= { | 426 | QWidget *buttons[]= { |
427 | // yearBackward, | 427 | // yearBackward, |
428 | // monthBackward, | 428 | // monthBackward, |
429 | selectMonth, | 429 | selectMonth, |
430 | selectYear, | 430 | selectYear, |
431 | // monthForward, | 431 | // monthForward, |
432 | // yearForward | 432 | // yearForward |
433 | }; | 433 | }; |
434 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); | 434 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); |
435 | int count; | 435 | int count; |
436 | QFont font; | 436 | QFont font; |
437 | QRect r; | 437 | QRect r; |
438 | // ----- | 438 | // ----- |
439 | fontsize=s; | 439 | fontsize=s; |
440 | for(count=0; count<NoOfButtons; ++count) | 440 | for(count=0; count<NoOfButtons; ++count) |
441 | { | 441 | { |
442 | font=buttons[count]->font(); | 442 | font=buttons[count]->font(); |
443 | font.setPointSize(s); | 443 | font.setPointSize(s); |
444 | buttons[count]->setFont(font); | 444 | buttons[count]->setFont(font); |
445 | } | 445 | } |
446 | QFontMetrics metrics(selectMonth->fontMetrics()); | 446 | QFontMetrics metrics(selectMonth->fontMetrics()); |
447 | for(int i=1; i <= 12; ++i) | 447 | for(int i=1; i <= 12; ++i) |
448 | { // maxMonthRect is used by sizeHint() | 448 | { // maxMonthRect is used by sizeHint() |
449 | r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); | 449 | r=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); |
450 | maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); | 450 | maxMonthRect.setWidth(QMAX(r.width(), maxMonthRect.width())); |
451 | maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); | 451 | maxMonthRect.setHeight(QMAX(r.height(), maxMonthRect.height())); |
452 | } | 452 | } |
453 | table->setFontSize(s); | 453 | table->setFontSize(s); |
454 | } | 454 | } |
455 | 455 | ||
456 | void KDatePicker::virtual_hook( int id, void* data ) | 456 | void KDatePicker::virtual_hook( int id, void* data ) |
457 | { /*BASE::virtual_hook( id, data );*/ } | 457 | { /*BASE::virtual_hook( id, data );*/ } |
458 | 458 | ||
459 | void KDatePicker::keyPressEvent ( QKeyEvent * e ) | 459 | void KDatePicker::keyPressEvent ( QKeyEvent * e ) |
460 | { | 460 | { |
461 | switch ( e->key() ) { | 461 | switch ( e->key() ) { |
462 | case Qt::Key_Right: | 462 | case Qt::Key_Right: |
463 | monthForwardClicked(); | 463 | monthForwardClicked(); |
464 | break; | 464 | break; |
465 | case Qt::Key_Left: | 465 | case Qt::Key_Left: |
466 | monthBackwardClicked(); | 466 | monthBackwardClicked(); |
467 | break; | 467 | break; |
468 | 468 | ||
469 | case Qt::Key_Down: | 469 | case Qt::Key_Down: |
470 | yearForwardClicked(); | 470 | yearForwardClicked(); |
471 | 471 | ||
472 | break; | 472 | break; |
473 | 473 | ||
474 | case Qt::Key_Up: | 474 | case Qt::Key_Up: |
475 | yearBackwardClicked(); | 475 | yearBackwardClicked(); |
476 | break; | 476 | break; |
477 | 477 | ||
478 | case Qt::Key_Return: | 478 | case Qt::Key_Return: |
479 | case Qt::Key_Enter: | ||
479 | tableClickedSlot(); | 480 | tableClickedSlot(); |
480 | break; | 481 | break; |
481 | case Qt::Key_Escape: | 482 | case Qt::Key_Escape: |
482 | e->ignore(); | 483 | e->ignore(); |
483 | break; | 484 | break; |
484 | default: | 485 | default: |
485 | break; | 486 | break; |
486 | } | 487 | } |
487 | 488 | ||
488 | } | 489 | } |