summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt13
-rw-r--r--kalarmd/alarmdialog.cpp4
-rw-r--r--korganizer/calendarview.cpp28
-rw-r--r--korganizer/koagendaview.cpp27
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--libkcal/calendarlocal.cpp1
6 files changed, 57 insertions, 20 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index ce55780..5ef60be 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1261,56 +1261,65 @@
1261{ "Sending file...","Sende Datei..." }, 1261{ "Sending file...","Sende Datei..." },
1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." }, 1262{ "Waiting for synced file...","Warte auf gesyncte Daten..." },
1263{ "Receiving synced file...","Gesyncte Daten erhalten..." }, 1263{ "Receiving synced file...","Gesyncte Daten erhalten..." },
1264{ "Received %1 bytes","%1 Bytes erhalten" }, 1264{ "Received %1 bytes","%1 Bytes erhalten" },
1265{ "Writing file to disk...","Speichere Datei..." }, 1265{ "Writing file to disk...","Speichere Datei..." },
1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" }, 1266{ "Pi-Sync successful!","Pi-Sync erfolgreich!" },
1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" }, 1267{ "Clock skew of\nsyncing devices\nis %1 seconds!","Uhrzeitunterschied der\nsyncenden Geräte\nist %1 Sekunden!" },
1268{ "Synchronize!","Synchronisiere!" }, 1268{ "Synchronize!","Synchronisiere!" },
1269{ "High clock skew!","Großer Uhrzeitunterschied!" }, 1269{ "High clock skew!","Großer Uhrzeitunterschied!" },
1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" }, 1270{ "ADJUST\nYOUR\nCLOCKS!","JUSTIERE\nDIE\nUHREN!" },
1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" }, 1271{ "The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!","Die Uhren der syncenden Geräte\nhaben einen Unterschied von\nmehr als 5 Minuten. Bitte die\nUhrzeiten anpassen. Sie können\nfalsche Sync-Resultate erhalten!\nBitte das Syncen bestätigen!" },
1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." }, 1272{ "This is a %1 recurring todo.","Das ist eine %1 wiederholende Aufgabe." },
1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" }, 1273{ "<p><b>Start on:</b> %1</p>","<p><b>Start am:</b> %1</p>" },
1274{ "List week view","Listenwochenansicht" }, 1274{ "List week view","Listenwochenansicht" },
1275{ "List week","Listenwochenansicht" }, 1275{ "List week","Listenwochenansicht" },
1276{ "Next Week","Nächste Woche" }, 1276{ "Next Week","Nächste Woche" },
1277{ "Previous Week","Vorherige Woche" }, 1277{ "Previous Week","Vorherige Woche" },
1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." }, 1278{ "No items were found matching\nyour search expression.\nUse the wildcard characters\n'*' and '?' where needed.","Keine Einträge gefunden die\ndem Suchausdruck entsprechen.\nBenutze Platzhalter Zeichen\n'*' und '?' wo benötigt." },
1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" }, 1279{ "Show in todo/event viewer:","Zeige in Termin/Todo Anzeige:" },
1280{ "Details","Details" }, 1280{ "Details","Details" },
1281{ "Created time","Erstellt Zeit" }, 1281{ "Created time","Erstellt Zeit" },
1282{ "Last modified time","Geändert Zeit" }, 1282{ "Last modified time","Geändert Zeit" },
1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" }, 1283{ "Show in What'sThis quick overview:","Zeige in What'sThis Schnellübersicht:" },
1284{ "View Options","Anzeige Optionen" }, 1284{ "View Options","Anzeige Optionen" },
1285{ "<b>Created: ","<b>Erstellt am: " }, 1285{ "<b>Created: ","<b>Erstellt am: " },
1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " }, 1286{ "<b>Last modified: ","<b>Zuletzt geändert am: " },
1287{ "Journal: ","Journal: " }, 1287{ "Journal: ","Journal: " },
1288{ "yearly","jährlich" }, 1288{ "yearly","jährlich" },
1289{ "(%1) ","%1-" }, 1289{ "(%1) ","%1-" },
1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" }, 1290{ "<p><b>K</b>: Week view in Month view syle</p>\n","<p><b>K</b>: Wochenansicht in Art der Monatsansicht</p>\n" },
1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" }, 1291{ "Enable tooltips displaying summary of ev.","Titel-Tooltips anzeigen" },
1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" }, 1292{ "Enable scrollbars in month view cells","Scrollbar in Zellen anzeigen" },
1293{ "Summary/Loc.","Titel/Ort" }, 1293{ "Summary/Loc.","Titel/Ort" },
1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." }, 1294{ "No items found. Use '*' and '?' where needed.","Nichts gefunden. Benutze '*' and '?' wo benötigt." },
1295{ "Week Number","Wochennummer" }, 1295{ "Week Number","Wochennummer" },
1296{ "Import","Importiere" }, 1296{ "Import","Importiere" },
1297{ "Export","Exportiere" }, 1297{ "Export","Exportiere" },
1298{ "Beam","Beame" }, 1298{ "Beam","Beame" },
1299{ "Export selected","Exportiere Selektierte" }, 1299{ "Export selected","Exportiere Selektierte" },
1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." }, 1300{ "As iCal (ics) file...","Als iCal (ics) Datei..." },
1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." }, 1301{ "As vCal (vcs) file...","Als vCal (vcs) Datei..." },
1302{ "Journal/Details...","Journale/Details..." }, 1302{ "Journal/Details...","Journale/Details..." },
1303{ "Agenda View","Agenda Ansicht" }, 1303{ "Agenda View","Agenda Ansicht" },
1304{ "Show current time","Zeige aktuelle Zeit" }, 1304{ "Show current time","Zeige aktuelle Zeit" },
1305{ "Edit new item","Bearbeite neuen Eintrag" }, 1305{ "Edit new item","Bearbeite neuen Eintrag" },
1306{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, 1306{ "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" },
1307{ "There is no next alarm.","Es gibt keinen nächsten Alarm." }, 1307{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
1308{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, 1308{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
1309{ "The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)","Der nächste Alarm in am:\n%1\num: %2\n\n%3\n(%4)" }, 1309{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
1310{ "%1 days\n","%1 Tagen\n" },
1311{ "1 day\n","1 Tag\n" },
1312{ "%1 hours\n","%1 Stunden\n" },
1313{ "1 hour\n","1 Stunde\n" },
1314{ "%1 minutes\n","%1 Minuten\n" },
1315{ "1 minute\n","1 Minute\n" },
1316{ "","" },
1317{ "","" },
1318{ "","" },
1319{ "","" },
1310{ "","" }, 1320{ "","" },
1311{ "","" }, 1321{ "","" },
1312{ "","" }, 1322{ "","" },
1313{ "","" }, 1323{ "","" },
1314{ "","" }, 1324{ "","" },
1315{ "","" }, 1325{ "","" },
1316 \ No newline at end of file
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 7ead3b9..7b888ab 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,85 +1,89 @@
1/* 1/*
2 This file is part of the KDE alarm daemon. 2 This file is part of the KDE alarm daemon.
3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// $Id$ 24// $Id$
25 25
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qsound.h> 33#include <qsound.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#ifndef DESKTOP_VERSION
35#define protected public 36#define protected public
36#include <qspinbox.h> 37#include <qspinbox.h>
37#undef protected 38#undef protected
39#else
40#include <qspinbox.h>
41#endif
38#include <stdlib.h> 42#include <stdlib.h>
39#ifndef _WIN32_ 43#ifndef _WIN32_
40#include <unistd.h> 44#include <unistd.h>
41#include <sys/ioctl.h> 45#include <sys/ioctl.h>
42#endif 46#endif
43#include <stdio.h> 47#include <stdio.h>
44#include <fcntl.h> 48#include <fcntl.h>
45 49
46#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
47#include <qtopia/alarmserver.h> 51#include <qtopia/alarmserver.h>
48#include <qpe/resource.h> 52#include <qpe/resource.h>
49#include <qtopia/sound.h> 53#include <qtopia/sound.h>
50 54
51#endif 55#endif
52 56
53#include "alarmdialog.h" 57#include "alarmdialog.h"
54 58
55 59
56AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 60AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
57 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) 61 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop )
58{ 62{
59 setCaption( "KO/Pi Alarm!" ); 63 setCaption( "KO/Pi Alarm!" );
60 QVBoxLayout* layout = new QVBoxLayout( this); 64 QVBoxLayout* layout = new QVBoxLayout( this);
61 QLabel* l = new QLabel("The following event triggered alarm:",this); 65 QLabel* l = new QLabel("The following event triggered alarm:",this);
62 layout->addWidget ( l ); 66 layout->addWidget ( l );
63 l->setAlignment( AlignCenter); 67 l->setAlignment( AlignCenter);
64 mMessage = new QLabel ( " ", this ); 68 mMessage = new QLabel ( " ", this );
65 int fs = 18; 69 int fs = 18;
66 int fs2 = 12; 70 int fs2 = 12;
67 if ( QApplication::desktop()->width() < 480 ) { 71 if ( QApplication::desktop()->width() < 480 ) {
68 setMaximumSize(220, 260); 72 setMaximumSize(220, 260);
69 fs2 = 10; 73 fs2 = 10;
70 } 74 }
71 else { 75 else {
72 setMaximumSize(440, 440); 76 setMaximumSize(440, 440);
73 } 77 }
74 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
75 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
76 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
77 fo.setBold( true ); 81 fo.setBold( true );
78 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
79 l->setFont( fo ); 83 l->setFont( fo );
80 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
81 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
82 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
83 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
84 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
85 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 73aa733..a330414 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -4024,59 +4024,81 @@ void CalendarView::removeSyncInfo( QString syncProfile)
4024 4024
4025} 4025}
4026 4026
4027void CalendarView::undo_delete() 4027void CalendarView::undo_delete()
4028{ 4028{
4029 //qDebug("undo_delete() "); 4029 //qDebug("undo_delete() ");
4030 Incidence* undo = mCalendar->undoIncidence(); 4030 Incidence* undo = mCalendar->undoIncidence();
4031 if ( !undo ) { 4031 if ( !undo ) {
4032 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4032 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4033 i18n("KO/Pi")); 4033 i18n("KO/Pi"));
4034 return; 4034 return;
4035 } 4035 }
4036 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 4036 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
4037 i18n("\nAre you sure you want\nto restore this?"), 4037 i18n("\nAre you sure you want\nto restore this?"),
4038 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4038 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4039 mCalendar->undoDeleteIncidence(); 4039 mCalendar->undoDeleteIncidence();
4040 updateView(); 4040 updateView();
4041 } 4041 }
4042} 4042}
4043 4043
4044void CalendarView::slotViewerClosed() 4044void CalendarView::slotViewerClosed()
4045{ 4045{
4046 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4046 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4047} 4047}
4048 4048
4049void CalendarView::resetFocus() 4049void CalendarView::resetFocus()
4050{ 4050{
4051 if ( mViewerCallerIsSearchDialog ) { 4051 if ( mViewerCallerIsSearchDialog ) {
4052 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4052 if ( mDialogManager->getSearchDialog()->isVisible() ){
4053 mDialogManager->getSearchDialog()->raise(); 4053 mDialogManager->getSearchDialog()->raise();
4054 mDialogManager->getSearchDialog()->setActiveWindow(); 4054 mDialogManager->getSearchDialog()->setActiveWindow();
4055 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4055 mDialogManager->getSearchDialog()->listview()->resetFocus();
4056 } else 4056 } else
4057 mViewerCallerIsSearchDialog = false; 4057 mViewerCallerIsSearchDialog = false;
4058 } 4058 }
4059 if ( !mViewerCallerIsSearchDialog ) { 4059 if ( !mViewerCallerIsSearchDialog ) {
4060 //mViewManager->currentView()->setFocus(); 4060 //mViewManager->currentView()->setFocus();
4061 //qDebug("sssssssssssssssset focus "); 4061 //qDebug("sssssssssssssssset focus ");
4062 topLevelWidget()->raise(); 4062 topLevelWidget()->raise();
4063 setActiveWindow(); 4063 setActiveWindow();
4064 //setFocus(); 4064 //setFocus();
4065 } 4065 }
4066 mViewerCallerIsSearchDialog = false; 4066 mViewerCallerIsSearchDialog = false;
4067} 4067}
4068 4068
4069void CalendarView::showNextAlarms() 4069void CalendarView::showNextAlarms()
4070{ 4070{
4071 QString message; 4071 QString message;
4072 if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4072 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4073 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4073 QString sum = mCalendar->nextSummary(); 4074 QString sum = mCalendar->nextSummary();
4074 QDateTime nextA = mNextAlarmDateTime; 4075 QDateTime nextA = mNextAlarmDateTime;
4075 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4076 QDateTime cur = QDateTime::currentDateTime();
4076 message = i18n("The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)").arg( KGlobal::locale()->formatDate(nextA.date() , false)).arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; 4077 int secs = cur.secsTo( nextA );
4078 int min = secs /60;
4079 int hours = min /60;
4080 min = min % 60;
4081 int days = hours /24;
4082 hours = hours % 24;
4083
4084 message = i18n("The next alarm is in:\n");
4085 if ( days > 1 )
4086 message += i18n("%1 days\n").arg( days );
4087 else if ( days == 1 )
4088 message += i18n("1 day\n");
4089 if ( hours > 1 )
4090 message += i18n("%1 hours\n").arg( hours );
4091 else if ( hours == 1 )
4092 message += i18n("1 hour\n");
4093 if ( min > 1 )
4094 message += i18n("%1 minutes\n").arg( min );
4095 else if ( min == 1 )
4096 message += i18n("1 minute\n");
4097
4098 message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ;
4077 } else { 4099 } else {
4078 message = i18n("There is no next alarm."); 4100 message = i18n("There is no next alarm.");
4079 4101
4080 } 4102 }
4081 KMessageBox::information( this, message); 4103 KMessageBox::information( this, message);
4082} 4104}
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 18f242c..f6f390b 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -80,175 +80,175 @@ using namespace KOrg;
80 80
81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : 81TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
82 QScrollView(parent,name,f) 82 QScrollView(parent,name,f)
83{ 83{
84 mRows = rows; 84 mRows = rows;
85 85
86 setMinimumHeight( 20 ); 86 setMinimumHeight( 20 );
87 mCellHeight = KOPrefs::instance()->mHourSize*4; 87 mCellHeight = KOPrefs::instance()->mHourSize*4;
88 88
89 enableClipper(true); 89 enableClipper(true);
90 90
91 setHScrollBarMode(AlwaysOff); 91 setHScrollBarMode(AlwaysOff);
92 setVScrollBarMode(AlwaysOff); 92 setVScrollBarMode(AlwaysOff);
93 93
94 resizeContents(50,mRows * mCellHeight); 94 resizeContents(50,mRows * mCellHeight);
95 95
96 viewport()->setBackgroundMode( PaletteBackground ); 96 viewport()->setBackgroundMode( PaletteBackground );
97} 97}
98 98
99void TimeLabels::setCellHeight(int height) 99void TimeLabels::setCellHeight(int height)
100{ 100{
101 mCellHeight = height; 101 mCellHeight = height;
102} 102}
103 103
104/* 104/*
105 Optimization so that only the "dirty" portion of the scroll view 105 Optimization so that only the "dirty" portion of the scroll view
106 is redrawn. Unfortunately, this is not called by default paintEvent() method. 106 is redrawn. Unfortunately, this is not called by default paintEvent() method.
107*/ 107*/
108void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) 108void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
109{ 109{
110 110
111 // if ( globalFlagBlockAgenda ) 111 // if ( globalFlagBlockAgenda )
112 // return; 112 // return;
113 // bug: the parameters cx, cy, cw, ch are the areas that need to be 113 // bug: the parameters cx, cy, cw, ch are the areas that need to be
114 // redrawn, not the area of the widget. unfortunately, this 114 // redrawn, not the area of the widget. unfortunately, this
115 // code assumes the latter... 115 // code assumes the latter...
116 116
117 // now, for a workaround... 117 // now, for a workaround...
118 // these two assignments fix the weird redraw bug 118 // these two assignments fix the weird redraw bug
119 cx = contentsX() + 2; 119 cx = contentsX() + 2;
120 cw = contentsWidth() - 2; 120 cw = contentsWidth() - 2;
121 // end of workaround 121 // end of workaround
122 122
123 int cell = ((int)(cy/mCellHeight)); 123 int cell = ((int)(cy/mCellHeight));
124 int y = cell * mCellHeight; 124 int y = cell * mCellHeight;
125 QFontMetrics fm = fontMetrics(); 125 QFontMetrics fm = fontMetrics();
126 QString hour; 126 QString hour;
127 QString suffix; 127 QString suffix;
128 QString fullTime;
129 int tW = fm.width("24:00i"); 128 int tW = fm.width("24:00i");
130 int timeHeight = fm.height(); 129 int timeHeight = fm.height();
131 //timeHeight -= (timeHeight/4-2); 130 //timeHeight -= (timeHeight/4-2);
132 int borderWidth = 0; 131 int borderWidth = 0;
133 QFont nFont = p->font(); 132 QFont nFont = p->font();
134 133
135 if (!KGlobal::locale()->use12Clock()) 134 if (!KGlobal::locale()->use12Clock())
136 suffix = "00"; 135 suffix = "00";
137 else 136 else
138 borderWidth = 0; 137 borderWidth = 0;
139 if ( timeHeight > mCellHeight ) { 138 if ( timeHeight > mCellHeight ) {
140 timeHeight = mCellHeight-1; 139 timeHeight = mCellHeight-1;
141 int pointS = nFont.pointSize(); 140 int pointS = nFont.pointSize();
142 while ( pointS > 4 ) { 141 while ( pointS > 4 ) {
143 nFont.setPointSize( pointS ); 142 nFont.setPointSize( pointS );
144 fm = QFontMetrics( nFont ); 143 fm = QFontMetrics( nFont );
145 if ( fm.height() < mCellHeight ) 144 if ( fm.height() < mCellHeight )
146 break; 145 break;
147 -- pointS; 146 -- pointS;
148 } 147 }
149 fm = QFontMetrics( nFont ); 148 fm = QFontMetrics( nFont );
150 borderWidth = 4; 149 borderWidth = 4;
151 timeHeight = fm.height(); 150 timeHeight = fm.height();
152 } 151 }
153 timeHeight -= (timeHeight/4-2); 152 timeHeight -= (timeHeight/4-2);
154 QFont sFont = nFont; 153 QFont sFont = nFont;
155 sFont.setPointSize( sFont.pointSize()/2+2 ); 154 sFont.setPointSize( sFont.pointSize()/2+2 );
156 QFontMetrics fmS( sFont ); 155 QFontMetrics fmS( sFont );
157 int sHei = fmS.height(); 156 int sHei = fmS.height();
158 157 sHei -= (sHei/4-2);
158 int startW = this->width() - frameWidth();
159 while (y < cy + ch) { 159 while (y < cy + ch) {
160 p->drawLine(cx,y,cx+tW,y); 160 p->drawLine(cx,y,cx+tW,y);
161 hour.setNum(cell); 161 hour.setNum(cell);
162 162
163 // handle 24h and am/pm time formats 163 // handle 24h and am/pm time formats
164 if (KGlobal::locale()->use12Clock()) { 164 if (KGlobal::locale()->use12Clock()) {
165 if (cell > 11) suffix = "pm"; 165 if (cell > 11) suffix = "pm";
166 else 166 else
167 suffix = "am"; 167 suffix = "am";
168 if (cell == 0) hour.setNum(12); 168 if (cell == 0) hour.setNum(12);
169 if (cell > 12) hour.setNum(cell - 12); 169 if (cell > 12) hour.setNum(cell - 12);
170 } 170 }
171 171
172 // create string in format of "XX:XX" or "XXpm/am"
173 fullTime = hour;// + suffix;
174
175 // center and draw the time label 172 // center and draw the time label
176 int timeWidth = fm.width(fullTime+"i"); 173 int timeWidth = fm.width(hour+"i");
177 int tw2 = fm.width(suffix); 174 int tw2 = fm.width(suffix);
178 int offset = this->width() - timeWidth - tw2; 175 int offset = startW - timeWidth - tw2 ;
179 p->setFont( nFont ); 176 p->setFont( nFont );
180 p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); 177 p->drawText(cx - borderWidth + offset, y+ timeHeight, hour);
181 p->setFont( sFont ); 178 p->setFont( sFont );
182 offset += timeWidth; 179 offset = startW - tw2-1;
183 p->drawText(cx - borderWidth + offset, y+ sHei, suffix); 180 p->drawText(cx - borderWidth + offset, y+ sHei, suffix);
184 181
185 // increment indices 182 // increment indices
186 y += mCellHeight; 183 y += mCellHeight;
187 cell++; 184 cell++;
188 } 185 }
189} 186}
190 187
191/** 188/**
192 Calculates the minimum width. 189 Calculates the minimum width.
193*/ 190*/
194int TimeLabels::minimumWidth() const 191int TimeLabels::minimumWidth() const
195{ 192{
196 return mMiniWidth; 193 return mMiniWidth;
197} 194}
198 195
199/** updates widget's internal state */ 196/** updates widget's internal state */
200void TimeLabels::updateConfig() 197void TimeLabels::updateConfig()
201{ 198{
202 // set the font 199 // set the font
203 // config->setGroup("Fonts"); 200 // config->setGroup("Fonts");
204 // QFont font = config->readFontEntry("TimeBar Font"); 201 // QFont font = config->readFontEntry("TimeBar Font");
205 setFont(KOPrefs::instance()->mTimeBarFont); 202 setFont(KOPrefs::instance()->mTimeBarFont);
206 mMiniWidth = fontMetrics().width("88:88") + 2 ; 203 QString test = "88:88";
204 if (KGlobal::locale()->use12Clock())
205 test += "i";
206 mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ;
207 // update geometry restrictions based on new settings 207 // update geometry restrictions based on new settings
208 setFixedWidth(minimumWidth()); 208 setFixedWidth(minimumWidth());
209 209
210 // update HourSize 210 // update HourSize
211 mCellHeight = KOPrefs::instance()->mHourSize*4; 211 mCellHeight = KOPrefs::instance()->mHourSize*4;
212 resizeContents(50,mRows * mCellHeight); 212 resizeContents(50,mRows * mCellHeight);
213} 213}
214 214
215/** update time label positions */ 215/** update time label positions */
216void TimeLabels::positionChanged() 216void TimeLabels::positionChanged()
217{ 217{
218 int adjustment = mAgenda->contentsY(); 218 int adjustment = mAgenda->contentsY();
219 setContentsPos(0, adjustment); 219 setContentsPos(0, adjustment);
220} 220}
221 221
222/** */ 222/** */
223void TimeLabels::setAgenda(KOAgenda* agenda) 223void TimeLabels::setAgenda(KOAgenda* agenda)
224{ 224{
225 mAgenda = agenda; 225 mAgenda = agenda;
226} 226}
227 227
228void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 228void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
229{ 229{
230 mMouseDownY = e->pos().y(); 230 mMouseDownY = e->pos().y();
231 mOrgCap = topLevelWidget()->caption(); 231 mOrgCap = topLevelWidget()->caption();
232} 232}
233 233
234void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 234void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
235{ 235{
236 int diff = mMouseDownY - e->pos().y(); 236 int diff = mMouseDownY - e->pos().y();
237 if ( diff < 10 && diff > -10 ) 237 if ( diff < 10 && diff > -10 )
238 return; 238 return;
239 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 239 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
240 if ( tSize < 4 ) 240 if ( tSize < 4 )
241 tSize = 4; 241 tSize = 4;
242 if ( tSize > 22 ) 242 if ( tSize > 22 )
243 tSize = 22; 243 tSize = 22;
244 tSize = (tSize-2)/2; 244 tSize = (tSize-2)/2;
245 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 245 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
246 246
247} 247}
248void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 248void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
249{ 249{
250 topLevelWidget()->setCaption( mOrgCap ); 250 topLevelWidget()->setCaption( mOrgCap );
251 int diff = mMouseDownY - e->pos().y(); 251 int diff = mMouseDownY - e->pos().y();
252 if ( diff < 10 && diff > -10 ) 252 if ( diff < 10 && diff > -10 )
253 return; 253 return;
254 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 254 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
@@ -791,101 +791,98 @@ void KOAgendaView::createDayLabels()
791 CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); 791 CalendarDecoration::List cds = KOCore::self()->calendarDecorations();
792 CalendarDecoration *it; 792 CalendarDecoration *it;
793 for(it = cds.first(); it; it = cds.next()) { 793 for(it = cds.first(); it; it = cds.next()) {
794 QString text = it->shortText( date ); 794 QString text = it->shortText( date );
795 if ( !text.isEmpty() ) { 795 if ( !text.isEmpty() ) {
796 QLabel *label = new QLabel(text,mDayLabels); 796 QLabel *label = new QLabel(text,mDayLabels);
797 label->setAlignment(AlignCenter); 797 label->setAlignment(AlignCenter);
798 dayLayout->addWidget(label); 798 dayLayout->addWidget(label);
799 } 799 }
800 } 800 }
801 801
802 for(it = cds.first(); it; it = cds.next()) { 802 for(it = cds.first(); it; it = cds.next()) {
803 QWidget *wid = it->smallWidget(mDayLabels,date); 803 QWidget *wid = it->smallWidget(mDayLabels,date);
804 if ( wid ) { 804 if ( wid ) {
805 // wid->setHeight(20); 805 // wid->setHeight(20);
806 dayLayout->addWidget(wid); 806 dayLayout->addWidget(wid);
807 } 807 }
808 } 808 }
809#endif 809#endif
810 } 810 }
811 if ( ! appendLabels ) { 811 if ( ! appendLabels ) {
812 dayLabel = mDayLabelsList.next(); 812 dayLabel = mDayLabelsList.next();
813 if ( !dayLabel ) 813 if ( !dayLabel )
814 appendLabels = true; 814 appendLabels = true;
815 } 815 }
816 if ( appendLabels ) { 816 if ( appendLabels ) {
817 dayLabel = getNewDaylabel(); 817 dayLabel = getNewDaylabel();
818 } 818 }
819 //dayLabel->hide();//test only 819 //dayLabel->hide();//test only
820 820
821 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; 821 int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ;
822 if ( offset < 0 ) offset = 0; 822 if ( offset < 0 ) offset = 0;
823 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); 823 //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 );
824 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); 824 dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) );
825 dayLabel->setFont( dlf ); 825 dayLabel->setFont( dlf );
826 dayLabel->show(); 826 dayLabel->show();
827 dayLabel->setNum( -2 ); 827 dayLabel->setNum( -2 );
828 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); 828 dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset );
829 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); 829 //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);
830 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); 830 //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
831 if ( !appendLabels ) { 831 if ( !appendLabels ) {
832 dayLabel = mDayLabelsList.next(); 832 dayLabel = mDayLabelsList.next();
833 while ( dayLabel ) { 833 while ( dayLabel ) {
834 //qDebug("!dayLabel %d",dayLabel ); 834 //qDebug("!dayLabel %d",dayLabel );
835 dayLabel->hide(); 835 dayLabel->hide();
836 dayLabel = mDayLabelsList.next(); 836 dayLabel = mDayLabelsList.next();
837 } 837 }
838 } 838 }
839 //mDayLabelsFrame->show(); 839
840 //mDayLabels->show(); 840 mDayLabelsFrame->setFixedHeight( newHight + 4 );
841 //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight);
842 //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight );
843 mDayLabelsFrame->setFixedHeight( newHight );
844} 841}
845 842
846int KOAgendaView::maxDatesHint() 843int KOAgendaView::maxDatesHint()
847{ 844{
848 // Not sure about the max number of events, so return 0 for now. 845 // Not sure about the max number of events, so return 0 for now.
849 return 0; 846 return 0;
850} 847}
851 848
852int KOAgendaView::currentDateCount() 849int KOAgendaView::currentDateCount()
853{ 850{
854 return mSelectedDates.count(); 851 return mSelectedDates.count();
855} 852}
856 853
857QPtrList<Incidence> KOAgendaView::selectedIncidences() 854QPtrList<Incidence> KOAgendaView::selectedIncidences()
858{ 855{
859 QPtrList<Incidence> selected; 856 QPtrList<Incidence> selected;
860 Incidence *incidence; 857 Incidence *incidence;
861 858
862 incidence = mAgenda->selectedIncidence(); 859 incidence = mAgenda->selectedIncidence();
863 if (incidence) selected.append(incidence); 860 if (incidence) selected.append(incidence);
864 861
865 incidence = mAllDayAgenda->selectedIncidence(); 862 incidence = mAllDayAgenda->selectedIncidence();
866 if (incidence) selected.append(incidence); 863 if (incidence) selected.append(incidence);
867 864
868 return selected; 865 return selected;
869} 866}
870 867
871DateList KOAgendaView::selectedDates() 868DateList KOAgendaView::selectedDates()
872{ 869{
873 DateList selected; 870 DateList selected;
874 QDate qd; 871 QDate qd;
875 872
876 qd = mAgenda->selectedIncidenceDate(); 873 qd = mAgenda->selectedIncidenceDate();
877 if (qd.isValid()) selected.append(qd); 874 if (qd.isValid()) selected.append(qd);
878 875
879 qd = mAllDayAgenda->selectedIncidenceDate(); 876 qd = mAllDayAgenda->selectedIncidenceDate();
880 if (qd.isValid()) selected.append(qd); 877 if (qd.isValid()) selected.append(qd);
881 878
882 return selected; 879 return selected;
883} 880}
884 881
885 882
886void KOAgendaView::updateView() 883void KOAgendaView::updateView()
887{ 884{
888 if ( mBlockUpdating ) 885 if ( mBlockUpdating )
889 return; 886 return;
890 // kdDebug() << "KOAgendaView::updateView()" << endl; 887 // kdDebug() << "KOAgendaView::updateView()" << endl;
891 fillAgenda(); 888 fillAgenda();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7a4275b..ca0d542 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1678,98 +1678,102 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1678 case Qt::Key_0: 1678 case Qt::Key_0:
1679 case Qt::Key_1: 1679 case Qt::Key_1:
1680 case Qt::Key_2: 1680 case Qt::Key_2:
1681 case Qt::Key_3: 1681 case Qt::Key_3:
1682 case Qt::Key_4: 1682 case Qt::Key_4:
1683 case Qt::Key_5: 1683 case Qt::Key_5:
1684 case Qt::Key_6: 1684 case Qt::Key_6:
1685 case Qt::Key_7: 1685 case Qt::Key_7:
1686 case Qt::Key_8: 1686 case Qt::Key_8:
1687 case Qt::Key_9: 1687 case Qt::Key_9:
1688 pro = e->key()-48; 1688 pro = e->key()-48;
1689 if ( pro == 0 ) 1689 if ( pro == 0 )
1690 pro = 10; 1690 pro = 10;
1691 if ( e->state() == Qt::ControlButton) 1691 if ( e->state() == Qt::ControlButton)
1692 pro += 10; 1692 pro += 10;
1693 break; 1693 break;
1694 case Qt::Key_M: 1694 case Qt::Key_M:
1695 mView->viewManager()->showMonthView(); 1695 mView->viewManager()->showMonthView();
1696 showSelectedDates = true; 1696 showSelectedDates = true;
1697 break; 1697 break;
1698 case Qt::Key_Insert: 1698 case Qt::Key_Insert:
1699 mView->newEvent(); 1699 mView->newEvent();
1700 break; 1700 break;
1701 case Qt::Key_S : 1701 case Qt::Key_S :
1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1703 mView->newSubTodo(); 1703 mView->newSubTodo();
1704 else 1704 else
1705 mView->dialogManager()->showSearchDialog(); 1705 mView->dialogManager()->showSearchDialog();
1706 break; 1706 break;
1707 case Qt::Key_Y : 1707 case Qt::Key_Y :
1708 case Qt::Key_Z : 1708 case Qt::Key_Z :
1709 mView->viewManager()->showWorkWeekView(); 1709 mView->viewManager()->showWorkWeekView();
1710 showSelectedDates = true; 1710 showSelectedDates = true;
1711 break; 1711 break;
1712 case Qt::Key_U : 1712 case Qt::Key_U :
1713 mView->viewManager()->showWeekView(); 1713 mView->viewManager()->showWeekView();
1714 showSelectedDates = true; 1714 showSelectedDates = true;
1715 break; 1715 break;
1716 case Qt::Key_H : 1716 case Qt::Key_H :
1717 keyBindings(); 1717 keyBindings();
1718 break; 1718 break;
1719 case Qt::Key_W: 1719 case Qt::Key_W:
1720 mView->viewManager()->showWhatsNextView(); 1720 mView->viewManager()->showWhatsNextView();
1721 break; 1721 break;
1722 case Qt::Key_L: 1722 case Qt::Key_L:
1723 mView->viewManager()->showListView(); 1723 mView->viewManager()->showListView();
1724 break; 1724 break;
1725 case Qt::Key_N: 1725 case Qt::Key_N:
1726 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1727 mView->viewManager()->showNextView();
1728 else {
1726 mView->viewManager()->showNextXView(); 1729 mView->viewManager()->showNextXView();
1727 showSelectedDates = true; 1730 showSelectedDates = true;
1731 }
1728 break; 1732 break;
1729 case Qt::Key_V: 1733 case Qt::Key_V:
1730 mView->viewManager()->showTodoView(); 1734 mView->viewManager()->showTodoView();
1731 break; 1735 break;
1732 case Qt::Key_C: 1736 case Qt::Key_C:
1733 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1737 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1734 break; 1738 break;
1735 case Qt::Key_P: 1739 case Qt::Key_P:
1736 mView->showDatePicker( ); 1740 mView->showDatePicker( );
1737 break; 1741 break;
1738 case Qt::Key_F: 1742 case Qt::Key_F:
1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1743 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1740 mView->editFilters(); 1744 mView->editFilters();
1741 else 1745 else
1742 mView->toggleFilter(); 1746 mView->toggleFilter();
1743 break; 1747 break;
1744 case Qt::Key_X: 1748 case Qt::Key_X:
1745 mView->toggleDateNavigatorWidget(); 1749 mView->toggleDateNavigatorWidget();
1746 break; 1750 break;
1747 case Qt::Key_Space: 1751 case Qt::Key_Space:
1748 mView->toggleExpand(); 1752 mView->toggleExpand();
1749 break; 1753 break;
1750 case Qt::Key_A: 1754 case Qt::Key_A:
1751 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1755 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1752 mView->showNextAlarms(); 1756 mView->showNextAlarms();
1753 else 1757 else
1754 mView->toggleAllDaySize(); 1758 mView->toggleAllDaySize();
1755 break; 1759 break;
1756 case Qt::Key_T: 1760 case Qt::Key_T:
1757 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1761 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1758 mView->newTodo(); 1762 mView->newTodo();
1759 else { 1763 else {
1760 mView->goToday(); 1764 mView->goToday();
1761 showSelectedDates = true; 1765 showSelectedDates = true;
1762 } 1766 }
1763 break; 1767 break;
1764 case Qt::Key_J: 1768 case Qt::Key_J:
1765 mView->viewManager()->showJournalView(); 1769 mView->viewManager()->showJournalView();
1766 break; 1770 break;
1767 case Qt::Key_B: 1771 case Qt::Key_B:
1768 mView->editIncidenceDescription();; 1772 mView->editIncidenceDescription();;
1769 break; 1773 break;
1770 // case Qt::Key_Return: 1774 // case Qt::Key_Return:
1771 case Qt::Key_E: 1775 case Qt::Key_E:
1772 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1776 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1773 mView->newEvent(); 1777 mView->newEvent();
1774 else 1778 else
1775 mView->editIncidence(); 1779 mView->editIncidence();
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 52c298b..5c889c3 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -253,96 +253,97 @@ QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
253 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 253 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
254 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) 254 if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
255 if ( todo->summary().left(3) == "E: " ) 255 if ( todo->summary().left(3) == "E: " )
256 el.append( todo ); 256 el.append( todo );
257 } 257 }
258 258
259 return el; 259 return el;
260 260
261} 261}
262Event *CalendarLocal::event( QString syncProf, QString id ) 262Event *CalendarLocal::event( QString syncProf, QString id )
263{ 263{
264 Event *todo; 264 Event *todo;
265 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { 265 for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
266 if ( todo->getID( syncProf ) == id ) return todo; 266 if ( todo->getID( syncProf ) == id ) return todo;
267 } 267 }
268 268
269 return 0; 269 return 0;
270} 270}
271Todo *CalendarLocal::todo( const QString &uid ) 271Todo *CalendarLocal::todo( const QString &uid )
272{ 272{
273 Todo *todo; 273 Todo *todo;
274 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { 274 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
275 if ( todo->uid() == uid ) return todo; 275 if ( todo->uid() == uid ) return todo;
276 } 276 }
277 277
278 return 0; 278 return 0;
279} 279}
280QString CalendarLocal::nextSummary() const 280QString CalendarLocal::nextSummary() const
281{ 281{
282 return mNextSummary; 282 return mNextSummary;
283} 283}
284QDateTime CalendarLocal::nextAlarmEventDateTime() const 284QDateTime CalendarLocal::nextAlarmEventDateTime() const
285{ 285{
286 return mNextAlarmEventDateTime; 286 return mNextAlarmEventDateTime;
287} 287}
288void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) 288void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
289{ 289{
290 //mNextAlarmIncidence 290 //mNextAlarmIncidence
291 //mNextAlarmDateTime 291 //mNextAlarmDateTime
292 //return mNextSummary; 292 //return mNextSummary;
293 //return mNextAlarmEventDateTime; 293 //return mNextAlarmEventDateTime;
294 bool newNextAlarm = false; 294 bool newNextAlarm = false;
295 bool computeNextAlarm = false; 295 bool computeNextAlarm = false;
296 bool ok; 296 bool ok;
297 int offset; 297 int offset;
298 QDateTime nextA; 298 QDateTime nextA;
299 // QString nextSum; 299 // QString nextSum;
300 //QDateTime nextEvent; 300 //QDateTime nextEvent;
301 mNextAlarmEventDateTime = QDateTime();
301 if ( mNextAlarmIncidence == 0 || incidence == 0 ) { 302 if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
302 computeNextAlarm = true; 303 computeNextAlarm = true;
303 } else { 304 } else {
304 if ( ! deleted ) { 305 if ( ! deleted ) {
305 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 306 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ;
306 if ( ok ) { 307 if ( ok ) {
307 if ( nextA < mNextAlarmDateTime ) { 308 if ( nextA < mNextAlarmDateTime ) {
308 deRegisterAlarm(); 309 deRegisterAlarm();
309 mNextAlarmDateTime = nextA; 310 mNextAlarmDateTime = nextA;
310 mNextSummary = incidence->summary(); 311 mNextSummary = incidence->summary();
311 mNextAlarmEventDateTime = nextA.addSecs(offset ) ; 312 mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
312 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 313 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
313 newNextAlarm = true; 314 newNextAlarm = true;
314 mNextAlarmIncidence = incidence; 315 mNextAlarmIncidence = incidence;
315 } else { 316 } else {
316 if ( incidence == mNextAlarmIncidence ) { 317 if ( incidence == mNextAlarmIncidence ) {
317 computeNextAlarm = true; 318 computeNextAlarm = true;
318 } 319 }
319 } 320 }
320 } else { 321 } else {
321 if ( mNextAlarmIncidence == incidence ) { 322 if ( mNextAlarmIncidence == incidence ) {
322 computeNextAlarm = true; 323 computeNextAlarm = true;
323 } 324 }
324 } 325 }
325 } else { // deleted 326 } else { // deleted
326 if ( incidence == mNextAlarmIncidence ) { 327 if ( incidence == mNextAlarmIncidence ) {
327 computeNextAlarm = true; 328 computeNextAlarm = true;
328 } 329 }
329 } 330 }
330 } 331 }
331 if ( computeNextAlarm ) { 332 if ( computeNextAlarm ) {
332 deRegisterAlarm(); 333 deRegisterAlarm();
333 nextA = nextAlarm( 1000 ); 334 nextA = nextAlarm( 1000 );
334 if (! mNextAlarmIncidence ) { 335 if (! mNextAlarmIncidence ) {
335 return; 336 return;
336 } 337 }
337 newNextAlarm = true; 338 newNextAlarm = true;
338 } 339 }
339 if ( newNextAlarm ) 340 if ( newNextAlarm )
340 registerAlarm(); 341 registerAlarm();
341} 342}
342QString CalendarLocal:: getAlarmNotification() 343QString CalendarLocal:: getAlarmNotification()
343{ 344{
344 QString ret; 345 QString ret;
345 // this should not happen 346 // this should not happen
346 if (! mNextAlarmIncidence ) 347 if (! mNextAlarmIncidence )
347 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString; 348 return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
348 Alarm* alarm = mNextAlarmIncidence->alarms().first(); 349 Alarm* alarm = mNextAlarmIncidence->alarms().first();