-rw-r--r-- | kaddressbook/kaddressbookE.pro | 5 | ||||
-rw-r--r-- | kmicromail/kmicromailE.pro | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/korganizerE.pro | 7 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 79 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 14 |
6 files changed, 66 insertions, 45 deletions
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro index 41f293d..86166d8 100644 --- a/kaddressbook/kaddressbookE.pro +++ b/kaddressbook/kaddressbookE.pro | |||
@@ -1,163 +1,168 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | 3 | ||
4 | 4 | ||
5 | TARGET = kapi | 5 | TARGET = kapi |
6 | OBJECTS_DIR = obj/$(PLATFORM) | 6 | OBJECTS_DIR = obj/$(PLATFORM) |
7 | MOC_DIR = moc/$(PLATFORM) | 7 | MOC_DIR = moc/$(PLATFORM) |
8 | DESTDIR=$(QPEDIR)/bin | 8 | DESTDIR=$(QPEDIR)/bin |
9 | 9 | ||
10 | #LFLAGS += -Wl,-export-dynamic | 10 | #LFLAGS += -Wl,-export-dynamic |
11 | 11 | ||
12 | 12 | ||
13 | INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include | 13 | INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include |
14 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER | 14 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER |
15 | #DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL | 15 | #DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL |
16 | #DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER | 16 | #DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER |
17 | #DEFINES += KORG_NOLVALTERNATION | 17 | #DEFINES += KORG_NOLVALTERNATION |
18 | LIBS += -lmicrokdepim | 18 | LIBS += -lmicrokdepim |
19 | #LIBS += -lmicrokcal | 19 | #LIBS += -lmicrokcal |
20 | LIBS += -lmicrokde | 20 | LIBS += -lmicrokde |
21 | LIBS += -lmicrokcal | 21 | LIBS += -lmicrokcal |
22 | LIBS += -lmicroqtcompat | 22 | LIBS += -lmicroqtcompat |
23 | LIBS += -lmicrokabc | 23 | LIBS += -lmicrokabc |
24 | LIBS += -lqpe | 24 | LIBS += -lqpe |
25 | LIBS += -ljpeg | 25 | LIBS += -ljpeg |
26 | |||
27 | LIBS += -lmicrogammu | ||
28 | LIBS += -lbluetooth | ||
29 | LIBS += -lsdp | ||
30 | |||
26 | LIBS += $(QTOPIALIB) | 31 | LIBS += $(QTOPIALIB) |
27 | LIBS += -L$(QPEDIR)/lib | 32 | LIBS += -L$(QPEDIR)/lib |
28 | LIBS += -Wl,-export-dynamic | 33 | LIBS += -Wl,-export-dynamic |
29 | 34 | ||
30 | INTERFACES = \ | 35 | INTERFACES = \ |
31 | # filteredit_base.ui \ | 36 | # filteredit_base.ui \ |
32 | # kofilterview_base.ui \ | 37 | # kofilterview_base.ui \ |
33 | 38 | ||
34 | HEADERS = \ | 39 | HEADERS = \ |
35 | features/mergewidget.h \ | 40 | features/mergewidget.h \ |
36 | features/distributionlistwidget.h \ | 41 | features/distributionlistwidget.h \ |
37 | kcmconfigs/addresseewidget.h \ | 42 | kcmconfigs/addresseewidget.h \ |
38 | kcmconfigs/extensionconfigdialog.h \ | 43 | kcmconfigs/extensionconfigdialog.h \ |
39 | kcmconfigs/kcmkabconfig.h \ | 44 | kcmconfigs/kcmkabconfig.h \ |
40 | kcmconfigs/kabconfigwidget.h \ | 45 | kcmconfigs/kabconfigwidget.h \ |
41 | addresseeeditordialog.h \ | 46 | addresseeeditordialog.h \ |
42 | addresseeeditorwidget.h \ | 47 | addresseeeditorwidget.h \ |
43 | addresseditwidget.h \ | 48 | addresseditwidget.h \ |
44 | addresseeconfig.h \ | 49 | addresseeconfig.h \ |
45 | addresseeutil.h \ | 50 | addresseeutil.h \ |
46 | emaileditwidget.h \ | 51 | emaileditwidget.h \ |
47 | filtereditdialog.h \ | 52 | filtereditdialog.h \ |
48 | kaddressbookmain.h \ | 53 | kaddressbookmain.h \ |
49 | kabprefs.h \ | 54 | kabprefs.h \ |
50 | kabcore.h \ | 55 | kabcore.h \ |
51 | viewmanager.h \ | 56 | viewmanager.h \ |
52 | extensionmanager.h \ | 57 | extensionmanager.h \ |
53 | extensionwidget.h \ | 58 | extensionwidget.h \ |
54 | kaddressbookview.h \ | 59 | kaddressbookview.h \ |
55 | geowidget.h \ | 60 | geowidget.h \ |
56 | imagewidget.h \ | 61 | imagewidget.h \ |
57 | incsearchwidget.h \ | 62 | incsearchwidget.h \ |
58 | jumpbuttonbar.h \ | 63 | jumpbuttonbar.h \ |
59 | phoneeditwidget.h \ | 64 | phoneeditwidget.h \ |
60 | secrecywidget.h \ | 65 | secrecywidget.h \ |
61 | keywidget.h \ | 66 | keywidget.h \ |
62 | nameeditdialog.h \ | 67 | nameeditdialog.h \ |
63 | filter.h \ | 68 | filter.h \ |
64 | addviewdialog.h \ | 69 | addviewdialog.h \ |
65 | configurewidget.h \ | 70 | configurewidget.h \ |
66 | viewconfigurewidget.h \ | 71 | viewconfigurewidget.h \ |
67 | viewconfigurefieldspage.h \ | 72 | viewconfigurefieldspage.h \ |
68 | viewconfigurefilterpage.h \ | 73 | viewconfigurefilterpage.h \ |
69 | typecombo.h \ | 74 | typecombo.h \ |
70 | undo.h \ | 75 | undo.h \ |
71 | undocmds.h \ | 76 | undocmds.h \ |
72 | xxportmanager.h \ | 77 | xxportmanager.h \ |
73 | xxportobject.h \ | 78 | xxportobject.h \ |
74 | xxportselectdialog.h \ | 79 | xxportselectdialog.h \ |
75 | details/detailsviewcontainer.h \ | 80 | details/detailsviewcontainer.h \ |
76 | details/look_basic.h \ | 81 | details/look_basic.h \ |
77 | details/look_html.h \ | 82 | details/look_html.h \ |
78 | views/kaddressbookiconview.h \ | 83 | views/kaddressbookiconview.h \ |
79 | views/kaddressbooktableview.h \ | 84 | views/kaddressbooktableview.h \ |
80 | views/kaddressbookcardview.h \ | 85 | views/kaddressbookcardview.h \ |
81 | views/configuretableviewdialog.h \ | 86 | views/configuretableviewdialog.h \ |
82 | views/configurecardviewdialog.h \ | 87 | views/configurecardviewdialog.h \ |
83 | views/cardview.h \ | 88 | views/cardview.h \ |
84 | views/colorlistbox.h \ | 89 | views/colorlistbox.h \ |
85 | views/contactlistview.h \ | 90 | views/contactlistview.h \ |
86 | xxport/vcard_xxport.h \ | 91 | xxport/vcard_xxport.h \ |
87 | xxport/kde2_xxport.h \ | 92 | xxport/kde2_xxport.h \ |
88 | xxport/csv_xxport.h \ | 93 | xxport/csv_xxport.h \ |
89 | xxport/csvimportdialog.h \ | 94 | xxport/csvimportdialog.h \ |
90 | xxport/opie_xxport.h \ | 95 | xxport/opie_xxport.h \ |
91 | xxport/qtopia_xxport.h \ | 96 | xxport/qtopia_xxport.h \ |
92 | xxport/sharpdtm_xxport.h \ | 97 | xxport/sharpdtm_xxport.h \ |
93 | #details/look_details.h \ | 98 | #details/look_details.h \ |
94 | #mainwindoiw.h \ | 99 | #mainwindoiw.h \ |
95 | # alarmclient.h \ | 100 | # alarmclient.h \ |
96 | # calendarview.h \ | 101 | # calendarview.h \ |
97 | # customlistviewitem.h \ | 102 | # customlistviewitem.h \ |
98 | # datenavigator.h | 103 | # datenavigator.h |
99 | 104 | ||
100 | SOURCES = \ | 105 | SOURCES = \ |
101 | addresseeeditordialog.cpp \ | 106 | addresseeeditordialog.cpp \ |
102 | addresseeeditorwidget.cpp \ | 107 | addresseeeditorwidget.cpp \ |
103 | addresseditwidget.cpp \ | 108 | addresseditwidget.cpp \ |
104 | addresseeconfig.cpp \ | 109 | addresseeconfig.cpp \ |
105 | addresseeutil.cpp \ | 110 | addresseeutil.cpp \ |
106 | extensionmanager.cpp \ | 111 | extensionmanager.cpp \ |
107 | features/mergewidget.cpp \ | 112 | features/mergewidget.cpp \ |
108 | features/distributionlistwidget.cpp \ | 113 | features/distributionlistwidget.cpp \ |
109 | kcmconfigs/addresseewidget.cpp \ | 114 | kcmconfigs/addresseewidget.cpp \ |
110 | kcmconfigs/extensionconfigdialog.cpp \ | 115 | kcmconfigs/extensionconfigdialog.cpp \ |
111 | kcmconfigs/kcmkabconfig.cpp \ | 116 | kcmconfigs/kcmkabconfig.cpp \ |
112 | kcmconfigs/kabconfigwidget.cpp \ | 117 | kcmconfigs/kabconfigwidget.cpp \ |
113 | emaileditwidget.cpp \ | 118 | emaileditwidget.cpp \ |
114 | filtereditdialog.cpp \ | 119 | filtereditdialog.cpp \ |
115 | mainembedded.cpp \ | 120 | mainembedded.cpp \ |
116 | kaddressbookmain.cpp \ | 121 | kaddressbookmain.cpp \ |
117 | kabcore.cpp \ | 122 | kabcore.cpp \ |
118 | kabprefs.cpp \ | 123 | kabprefs.cpp \ |
119 | viewmanager.cpp \ | 124 | viewmanager.cpp \ |
120 | kaddressbookview.cpp \ | 125 | kaddressbookview.cpp \ |
121 | extensionwidget.cpp \ | 126 | extensionwidget.cpp \ |
122 | geowidget.cpp \ | 127 | geowidget.cpp \ |
123 | imagewidget.cpp \ | 128 | imagewidget.cpp \ |
124 | incsearchwidget.cpp \ | 129 | incsearchwidget.cpp \ |
125 | jumpbuttonbar.cpp \ | 130 | jumpbuttonbar.cpp \ |
126 | phoneeditwidget.cpp \ | 131 | phoneeditwidget.cpp \ |
127 | secrecywidget.cpp \ | 132 | secrecywidget.cpp \ |
128 | keywidget.cpp \ | 133 | keywidget.cpp \ |
129 | nameeditdialog.cpp \ | 134 | nameeditdialog.cpp \ |
130 | filter.cpp \ | 135 | filter.cpp \ |
131 | addviewdialog.cpp \ | 136 | addviewdialog.cpp \ |
132 | configurewidget.cpp \ | 137 | configurewidget.cpp \ |
133 | viewconfigurewidget.cpp \ | 138 | viewconfigurewidget.cpp \ |
134 | viewconfigurefieldspage.cpp \ | 139 | viewconfigurefieldspage.cpp \ |
135 | viewconfigurefilterpage.cpp \ | 140 | viewconfigurefilterpage.cpp \ |
136 | undo.cpp \ | 141 | undo.cpp \ |
137 | undocmds.cpp \ | 142 | undocmds.cpp \ |
138 | xxportmanager.cpp \ | 143 | xxportmanager.cpp \ |
139 | xxportobject.cpp \ | 144 | xxportobject.cpp \ |
140 | xxportselectdialog.cpp \ | 145 | xxportselectdialog.cpp \ |
141 | details/detailsviewcontainer.cpp \ | 146 | details/detailsviewcontainer.cpp \ |
142 | details/look_basic.cpp \ | 147 | details/look_basic.cpp \ |
143 | details/look_html.cpp \ | 148 | details/look_html.cpp \ |
144 | views/kaddressbookiconview.cpp \ | 149 | views/kaddressbookiconview.cpp \ |
145 | views/kaddressbooktableview.cpp \ | 150 | views/kaddressbooktableview.cpp \ |
146 | views/kaddressbookcardview.cpp \ | 151 | views/kaddressbookcardview.cpp \ |
147 | views/configuretableviewdialog.cpp \ | 152 | views/configuretableviewdialog.cpp \ |
148 | views/configurecardviewdialog.cpp \ | 153 | views/configurecardviewdialog.cpp \ |
149 | views/cardview.cpp \ | 154 | views/cardview.cpp \ |
150 | views/contactlistview.cpp \ | 155 | views/contactlistview.cpp \ |
151 | views/colorlistbox.cpp \ | 156 | views/colorlistbox.cpp \ |
152 | xxport/vcard_xxport.cpp \ | 157 | xxport/vcard_xxport.cpp \ |
153 | xxport/kde2_xxport.cpp \ | 158 | xxport/kde2_xxport.cpp \ |
154 | xxport/csv_xxport.cpp \ | 159 | xxport/csv_xxport.cpp \ |
155 | xxport/csvimportdialog.cpp \ | 160 | xxport/csvimportdialog.cpp \ |
156 | xxport/opie_xxport.cpp \ | 161 | xxport/opie_xxport.cpp \ |
157 | xxport/qtopia_xxport.cpp \ | 162 | xxport/qtopia_xxport.cpp \ |
158 | xxport/sharpdtm_xxport.cpp \ | 163 | xxport/sharpdtm_xxport.cpp \ |
159 | #details/look_details.cpp \ | 164 | #details/look_details.cpp \ |
160 | #mainwindow.cpp \ | 165 | #mainwindow.cpp \ |
161 | # calendarview.cpp \ | 166 | # calendarview.cpp \ |
162 | # timespanview.cpp | 167 | # timespanview.cpp |
163 | 168 | ||
diff --git a/kmicromail/kmicromailE.pro b/kmicromail/kmicromailE.pro index 8d13796..9cedb21 100644 --- a/kmicromail/kmicromailE.pro +++ b/kmicromail/kmicromailE.pro | |||
@@ -1,65 +1,69 @@ | |||
1 | CONFIG += qt warn_on | 1 | CONFIG += qt warn_on |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | editaccounts.h \ | 4 | editaccounts.h \ |
5 | composemail.h \ | 5 | composemail.h \ |
6 | accountview.h \ | 6 | accountview.h \ |
7 | accountitem.h \ | 7 | accountitem.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | viewmail.h \ | 9 | viewmail.h \ |
10 | viewmailbase.h \ | 10 | viewmailbase.h \ |
11 | opiemail.h \ | 11 | opiemail.h \ |
12 | mailistviewitem.h \ | 12 | mailistviewitem.h \ |
13 | settingsdialog.h \ | 13 | settingsdialog.h \ |
14 | statuswidget.h \ | 14 | statuswidget.h \ |
15 | newmaildir.h \ | 15 | newmaildir.h \ |
16 | selectstore.h \ | 16 | selectstore.h \ |
17 | selectsmtp.h \ | 17 | selectsmtp.h \ |
18 | nntpgroups.h \ | 18 | nntpgroups.h \ |
19 | nntpgroupsdlg.h | 19 | nntpgroupsdlg.h |
20 | 20 | ||
21 | SOURCES = main.cpp \ | 21 | SOURCES = main.cpp \ |
22 | opiemail.cpp \ | 22 | opiemail.cpp \ |
23 | mainwindow.cpp \ | 23 | mainwindow.cpp \ |
24 | accountview.cpp \ | 24 | accountview.cpp \ |
25 | accountitem.cpp \ | 25 | accountitem.cpp \ |
26 | composemail.cpp \ | 26 | composemail.cpp \ |
27 | editaccounts.cpp \ | 27 | editaccounts.cpp \ |
28 | viewmail.cpp \ | 28 | viewmail.cpp \ |
29 | viewmailbase.cpp \ | 29 | viewmailbase.cpp \ |
30 | mailistviewitem.cpp \ | 30 | mailistviewitem.cpp \ |
31 | settingsdialog.cpp \ | 31 | settingsdialog.cpp \ |
32 | statuswidget.cpp \ | 32 | statuswidget.cpp \ |
33 | newmaildir.cpp \ | 33 | newmaildir.cpp \ |
34 | selectstore.cpp \ | 34 | selectstore.cpp \ |
35 | selectsmtp.cpp \ | 35 | selectsmtp.cpp \ |
36 | nntpgroups.cpp \ | 36 | nntpgroups.cpp \ |
37 | nntpgroupsdlg.cpp | 37 | nntpgroupsdlg.cpp |
38 | 38 | ||
39 | INTERFACES = editaccountsui.ui \ | 39 | INTERFACES = editaccountsui.ui \ |
40 | selectmailtypeui.ui \ | 40 | selectmailtypeui.ui \ |
41 | imapconfigui.ui \ | 41 | imapconfigui.ui \ |
42 | pop3configui.ui \ | 42 | pop3configui.ui \ |
43 | nntpconfigui.ui \ | 43 | nntpconfigui.ui \ |
44 | smtpconfigui.ui \ | 44 | smtpconfigui.ui \ |
45 | composemailui.ui \ | 45 | composemailui.ui \ |
46 | settingsdialogui.ui \ | 46 | settingsdialogui.ui \ |
47 | statuswidgetui.ui \ | 47 | statuswidgetui.ui \ |
48 | newmaildirui.ui \ | 48 | newmaildirui.ui \ |
49 | selectstoreui.ui \ | 49 | selectstoreui.ui \ |
50 | nntpgroupsui.ui | 50 | nntpgroupsui.ui |
51 | 51 | ||
52 | 52 | ||
53 | INCLUDEPATH += ../microkde ../microkde/kdecore ./libetpan/include $(QPEDIR)/include . .. ../microkde/kdeui ../qtcompat | 53 | INCLUDEPATH += ../microkde ../microkde/kdecore ./libetpan/include $(QPEDIR)/include . .. ../microkde/kdeui ../qtcompat |
54 | LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal | 54 | LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal |
55 | LIBS += $(QTOPIALIB) | 55 | LIBS += $(QTOPIALIB) |
56 | #LIBS += -lqtopia | 56 | #LIBS += -lqtopia |
57 | #next line for Zaurus only | 57 | #next line for Zaurus only |
58 | #LIBS += -luuid | 58 | #LIBS += -luuid |
59 | |||
60 | LIBS += -lmicrogammu | ||
61 | LIBS += -lbluetooth | ||
62 | LIBS += -lsdp | ||
59 | # | 63 | # |
60 | OBJECTS_DIR = obj/$(PLATFORM) | 64 | OBJECTS_DIR = obj/$(PLATFORM) |
61 | MOC_DIR = moc/$(PLATFORM) | 65 | MOC_DIR = moc/$(PLATFORM) |
62 | DESTDIR=$(QPEDIR)/bin | 66 | DESTDIR=$(QPEDIR)/bin |
63 | TARGET = ompi | 67 | TARGET = ompi |
64 | 68 | ||
65 | 69 | ||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a7f7010..b307649 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -167,2049 +167,2049 @@ class KOBeamPrefs : public QDialog | |||
167 | private: | 167 | private: |
168 | QRadioButton* vcal, *ical, *local, *tz; | 168 | QRadioButton* vcal, *ical, *local, *tz; |
169 | }; | 169 | }; |
170 | class KOCatPrefs : public QDialog | 170 | class KOCatPrefs : public QDialog |
171 | { | 171 | { |
172 | public: | 172 | public: |
173 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 173 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
174 | QDialog( parent, name, true ) | 174 | QDialog( parent, name, true ) |
175 | { | 175 | { |
176 | setCaption( i18n("Manage new Categories") ); | 176 | setCaption( i18n("Manage new Categories") ); |
177 | QVBoxLayout* lay = new QVBoxLayout( this ); | 177 | QVBoxLayout* lay = new QVBoxLayout( this ); |
178 | lay->setSpacing( 3 ); | 178 | lay->setSpacing( 3 ); |
179 | lay->setMargin( 3 ); | 179 | lay->setMargin( 3 ); |
180 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 180 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
181 | lay->addWidget( lab ); | 181 | lay->addWidget( lab ); |
182 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 182 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
183 | lay->addWidget( format ); | 183 | lay->addWidget( format ); |
184 | format->setExclusive ( true ) ; | 184 | format->setExclusive ( true ) ; |
185 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 185 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
186 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 186 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
187 | addCatBut->setChecked( true ); | 187 | addCatBut->setChecked( true ); |
188 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 188 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
189 | lay->addWidget( ok ); | 189 | lay->addWidget( ok ); |
190 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 190 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
191 | lay->addWidget( cancel ); | 191 | lay->addWidget( cancel ); |
192 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 192 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
193 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 193 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
194 | resize( 200, 200 ); | 194 | resize( 200, 200 ); |
195 | } | 195 | } |
196 | 196 | ||
197 | bool addCat() { return addCatBut->isChecked(); } | 197 | bool addCat() { return addCatBut->isChecked(); } |
198 | private: | 198 | private: |
199 | QRadioButton* addCatBut; | 199 | QRadioButton* addCatBut; |
200 | }; | 200 | }; |
201 | 201 | ||
202 | 202 | ||
203 | 203 | ||
204 | CalendarView::CalendarView( CalendarResources *calendar, | 204 | CalendarView::CalendarView( CalendarResources *calendar, |
205 | QWidget *parent, const char *name ) | 205 | QWidget *parent, const char *name ) |
206 | : CalendarViewBase( parent, name ), | 206 | : CalendarViewBase( parent, name ), |
207 | mCalendar( calendar ), | 207 | mCalendar( calendar ), |
208 | mResourceManager( calendar->resourceManager() ) | 208 | mResourceManager( calendar->resourceManager() ) |
209 | { | 209 | { |
210 | 210 | ||
211 | mEventEditor = 0; | 211 | mEventEditor = 0; |
212 | mTodoEditor = 0; | 212 | mTodoEditor = 0; |
213 | 213 | ||
214 | init(); | 214 | init(); |
215 | } | 215 | } |
216 | 216 | ||
217 | CalendarView::CalendarView( Calendar *calendar, | 217 | CalendarView::CalendarView( Calendar *calendar, |
218 | QWidget *parent, const char *name ) | 218 | QWidget *parent, const char *name ) |
219 | : CalendarViewBase( parent, name ), | 219 | : CalendarViewBase( parent, name ), |
220 | mCalendar( calendar ), | 220 | mCalendar( calendar ), |
221 | mResourceManager( 0 ) | 221 | mResourceManager( 0 ) |
222 | { | 222 | { |
223 | 223 | ||
224 | mEventEditor = 0; | 224 | mEventEditor = 0; |
225 | mTodoEditor = 0; | 225 | mTodoEditor = 0; |
226 | init();} | 226 | init();} |
227 | 227 | ||
228 | void CalendarView::init() | 228 | void CalendarView::init() |
229 | { | 229 | { |
230 | beamDialog = new KOBeamPrefs(); | 230 | beamDialog = new KOBeamPrefs(); |
231 | mDatePickerMode = 0; | 231 | mDatePickerMode = 0; |
232 | mCurrentSyncDevice = ""; | 232 | mCurrentSyncDevice = ""; |
233 | writeLocale(); | 233 | writeLocale(); |
234 | mViewManager = new KOViewManager( this ); | 234 | mViewManager = new KOViewManager( this ); |
235 | mDialogManager = new KODialogManager( this ); | 235 | mDialogManager = new KODialogManager( this ); |
236 | mEventViewerDialog = 0; | 236 | mEventViewerDialog = 0; |
237 | mModified = false; | 237 | mModified = false; |
238 | mReadOnly = false; | 238 | mReadOnly = false; |
239 | mSelectedIncidence = 0; | 239 | mSelectedIncidence = 0; |
240 | mCalPrinter = 0; | 240 | mCalPrinter = 0; |
241 | mFilters.setAutoDelete(true); | 241 | mFilters.setAutoDelete(true); |
242 | 242 | ||
243 | mCalendar->registerObserver( this ); | 243 | mCalendar->registerObserver( this ); |
244 | // TODO: Make sure that view is updated, when calendar is changed. | 244 | // TODO: Make sure that view is updated, when calendar is changed. |
245 | 245 | ||
246 | mStorage = new FileStorage( mCalendar ); | 246 | mStorage = new FileStorage( mCalendar ); |
247 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 247 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
248 | 248 | ||
249 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 249 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
250 | #ifndef KORG_NOSPLITTER | 250 | #ifndef KORG_NOSPLITTER |
251 | // create the main layout frames. | 251 | // create the main layout frames. |
252 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 252 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
253 | topLayout->addWidget(mPanner); | 253 | topLayout->addWidget(mPanner); |
254 | 254 | ||
255 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 255 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
256 | "CalendarView::LeftFrame"); | 256 | "CalendarView::LeftFrame"); |
257 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 257 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
258 | 258 | ||
259 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 259 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
260 | "CalendarView::DateNavigator", QDate::currentDate() ); | 260 | "CalendarView::DateNavigator", QDate::currentDate() ); |
261 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 261 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
262 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 262 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
263 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 263 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
264 | 264 | ||
265 | #ifdef KORG_NORESOURCEVIEW | 265 | #ifdef KORG_NORESOURCEVIEW |
266 | mResourceView = 0; | 266 | mResourceView = 0; |
267 | #else | 267 | #else |
268 | if ( mResourceManager ) { | 268 | if ( mResourceManager ) { |
269 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 269 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
270 | mResourceView->updateView(); | 270 | mResourceView->updateView(); |
271 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 271 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
272 | SLOT( updateView() ) ); | 272 | SLOT( updateView() ) ); |
273 | } else { | 273 | } else { |
274 | mResourceView = 0; | 274 | mResourceView = 0; |
275 | } | 275 | } |
276 | #endif | 276 | #endif |
277 | QWidget *rightBox = new QWidget( mPanner ); | 277 | QWidget *rightBox = new QWidget( mPanner ); |
278 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 278 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
279 | 279 | ||
280 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 280 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
281 | rightLayout->addWidget( mNavigatorBar ); | 281 | rightLayout->addWidget( mNavigatorBar ); |
282 | 282 | ||
283 | mRightFrame = new QWidgetStack( rightBox ); | 283 | mRightFrame = new QWidgetStack( rightBox ); |
284 | rightLayout->addWidget( mRightFrame, 1 ); | 284 | rightLayout->addWidget( mRightFrame, 1 ); |
285 | 285 | ||
286 | mLeftFrame = mLeftSplitter; | 286 | mLeftFrame = mLeftSplitter; |
287 | #else | 287 | #else |
288 | QWidget *mainBox = new QWidget( this ); | 288 | QWidget *mainBox = new QWidget( this ); |
289 | QWidget *leftFrame = new QWidget( mainBox ); | 289 | QWidget *leftFrame = new QWidget( mainBox ); |
290 | 290 | ||
291 | QBoxLayout * mainBoxLayout; | 291 | QBoxLayout * mainBoxLayout; |
292 | QBoxLayout * leftFrameLayout; | 292 | QBoxLayout * leftFrameLayout; |
293 | if ( KOPrefs::instance()->mVerticalScreen ) { | 293 | if ( KOPrefs::instance()->mVerticalScreen ) { |
294 | mainBoxLayout = new QVBoxLayout(mainBox); | 294 | mainBoxLayout = new QVBoxLayout(mainBox); |
295 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 295 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
296 | } else { | 296 | } else { |
297 | mainBoxLayout = new QHBoxLayout(mainBox); | 297 | mainBoxLayout = new QHBoxLayout(mainBox); |
298 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 298 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
299 | } | 299 | } |
300 | topLayout->addWidget( mainBox ); | 300 | topLayout->addWidget( mainBox ); |
301 | mainBoxLayout->addWidget (leftFrame); | 301 | mainBoxLayout->addWidget (leftFrame); |
302 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 302 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
303 | "CalendarView::DateNavigator", QDate::currentDate()); | 303 | "CalendarView::DateNavigator", QDate::currentDate()); |
304 | // mDateNavigator->blockSignals( true ); | 304 | // mDateNavigator->blockSignals( true ); |
305 | leftFrameLayout->addWidget( mDateNavigator ); | 305 | leftFrameLayout->addWidget( mDateNavigator ); |
306 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 306 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
307 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); | 307 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); |
308 | 308 | ||
309 | if ( QApplication::desktop()->width() < 480 ) { | 309 | if ( QApplication::desktop()->width() < 480 ) { |
310 | leftFrameLayout->addWidget(mFilterView); | 310 | leftFrameLayout->addWidget(mFilterView); |
311 | leftFrameLayout->addWidget(mTodoList, 2 ); | 311 | leftFrameLayout->addWidget(mTodoList, 2 ); |
312 | 312 | ||
313 | } else { | 313 | } else { |
314 | leftFrameLayout->addWidget(mTodoList,2 ); | 314 | leftFrameLayout->addWidget(mTodoList,2 ); |
315 | leftFrameLayout->addWidget(mFilterView ); | 315 | leftFrameLayout->addWidget(mFilterView ); |
316 | } | 316 | } |
317 | mFilterView->hide(); | 317 | mFilterView->hide(); |
318 | QWidget *rightBox = new QWidget( mainBox ); | 318 | QWidget *rightBox = new QWidget( mainBox ); |
319 | mainBoxLayout->addWidget ( rightBox, 10 ); | 319 | mainBoxLayout->addWidget ( rightBox, 10 ); |
320 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 320 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
321 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 321 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
322 | mRightFrame = new QWidgetStack( rightBox ); | 322 | mRightFrame = new QWidgetStack( rightBox ); |
323 | rightLayout->addWidget( mNavigatorBar ); | 323 | rightLayout->addWidget( mNavigatorBar ); |
324 | rightLayout->addWidget( mRightFrame, 10 ); | 324 | rightLayout->addWidget( mRightFrame, 10 ); |
325 | 325 | ||
326 | mLeftFrame = leftFrame; | 326 | mLeftFrame = leftFrame; |
327 | if ( KOPrefs::instance()->mVerticalScreen ) { | 327 | if ( KOPrefs::instance()->mVerticalScreen ) { |
328 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 328 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
329 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 329 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
330 | } else { | 330 | } else { |
331 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 331 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
332 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 332 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
333 | } | 333 | } |
334 | 334 | ||
335 | //qDebug("Calendarview Size %d %d ", width(), height()); | 335 | //qDebug("Calendarview Size %d %d ", width(), height()); |
336 | #endif | 336 | #endif |
337 | 337 | ||
338 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 338 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
339 | SLOT( showDates( const KCal::DateList & ) ) ); | 339 | SLOT( showDates( const KCal::DateList & ) ) ); |
340 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 340 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
341 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 341 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
342 | 342 | ||
343 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 343 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
344 | mNavigator, SLOT( selectPreviousYear() ) ); | 344 | mNavigator, SLOT( selectPreviousYear() ) ); |
345 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 345 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
346 | mNavigator, SLOT( selectNextYear() ) ); | 346 | mNavigator, SLOT( selectNextYear() ) ); |
347 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 347 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
348 | mNavigator, SLOT( selectPreviousMonth() ) ); | 348 | mNavigator, SLOT( selectPreviousMonth() ) ); |
349 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 349 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
350 | mNavigator, SLOT( selectNextMonth() ) ); | 350 | mNavigator, SLOT( selectNextMonth() ) ); |
351 | 351 | ||
352 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 352 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
353 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 353 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
354 | 354 | ||
355 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 355 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
356 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 356 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
357 | 357 | ||
358 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 358 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
359 | mNavigator, SLOT( selectPreviousYear() ) ); | 359 | mNavigator, SLOT( selectPreviousYear() ) ); |
360 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 360 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
361 | mNavigator, SLOT( selectNextYear() ) ); | 361 | mNavigator, SLOT( selectNextYear() ) ); |
362 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 362 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
363 | mNavigator, SLOT( selectPreviousMonth() ) ); | 363 | mNavigator, SLOT( selectPreviousMonth() ) ); |
364 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 364 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
365 | mNavigator, SLOT( selectNextMonth() ) ); | 365 | mNavigator, SLOT( selectNextMonth() ) ); |
366 | 366 | ||
367 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 367 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
368 | mNavigator, SLOT( selectPrevious() ) ); | 368 | mNavigator, SLOT( selectPrevious() ) ); |
369 | connect( mDateNavigator, SIGNAL( goNext() ), | 369 | connect( mDateNavigator, SIGNAL( goNext() ), |
370 | mNavigator, SLOT( selectNext() ) ); | 370 | mNavigator, SLOT( selectNext() ) ); |
371 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 371 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
372 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 372 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
373 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 373 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
374 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 374 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
375 | 375 | ||
376 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 376 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
377 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 377 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
378 | 378 | ||
379 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 379 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
380 | SLOT( eventAdded( Event *) ) ); | 380 | SLOT( eventAdded( Event *) ) ); |
381 | 381 | ||
382 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 382 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
383 | 383 | ||
384 | connect( this, SIGNAL( configChanged() ), | 384 | connect( this, SIGNAL( configChanged() ), |
385 | mDateNavigator, SLOT( updateConfig() ) ); | 385 | mDateNavigator, SLOT( updateConfig() ) ); |
386 | 386 | ||
387 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 387 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
388 | SLOT( newTodo() ) ); | 388 | SLOT( newTodo() ) ); |
389 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 389 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
390 | SLOT( newSubTodo( Todo * ) ) ); | 390 | SLOT( newSubTodo( Todo * ) ) ); |
391 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 391 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
392 | SLOT( editTodo( Todo * ) ) ); | 392 | SLOT( editTodo( Todo * ) ) ); |
393 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 393 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
394 | SLOT( showTodo( Todo *) ) ); | 394 | SLOT( showTodo( Todo *) ) ); |
395 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 395 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
396 | SLOT( deleteTodo( Todo *) ) ); | 396 | SLOT( deleteTodo( Todo *) ) ); |
397 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 397 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
398 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 398 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
399 | SLOT( purgeCompleted() ) ); | 399 | SLOT( purgeCompleted() ) ); |
400 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 400 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
401 | SIGNAL( todoModified( Todo *, int ) ) ); | 401 | SIGNAL( todoModified( Todo *, int ) ) ); |
402 | 402 | ||
403 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 403 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
404 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 404 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
405 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 405 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
406 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 406 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
407 | 407 | ||
408 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 408 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
409 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 409 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
410 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 410 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
411 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 411 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
412 | 412 | ||
413 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 413 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
414 | this, SLOT ( todo_unsub( Todo * ) ) ); | 414 | this, SLOT ( todo_unsub( Todo * ) ) ); |
415 | 415 | ||
416 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 416 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
417 | SLOT( updateTodo( Todo *, int ) ) ); | 417 | SLOT( updateTodo( Todo *, int ) ) ); |
418 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 418 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
419 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 419 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
420 | 420 | ||
421 | 421 | ||
422 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 422 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
423 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 423 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
424 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 424 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
425 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 425 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
426 | 426 | ||
427 | 427 | ||
428 | 428 | ||
429 | 429 | ||
430 | 430 | ||
431 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 431 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
432 | SLOT(checkClipboard())); | 432 | SLOT(checkClipboard())); |
433 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 433 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
434 | SLOT( processTodoListSelection( Incidence * ) ) ); | 434 | SLOT( processTodoListSelection( Incidence * ) ) ); |
435 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 435 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
436 | 436 | ||
437 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 437 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
438 | 438 | ||
439 | mDateFrame = new QVBox(0,0,WType_Popup); | 439 | mDateFrame = new QVBox(0,0,WType_Popup); |
440 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 440 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
441 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 441 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
442 | mDateFrame->setLineWidth(3); | 442 | mDateFrame->setLineWidth(3); |
443 | mDateFrame->hide(); | 443 | mDateFrame->hide(); |
444 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 444 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
445 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 445 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
446 | 446 | ||
447 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 447 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
448 | 448 | ||
449 | mEventEditor = mDialogManager->getEventEditor(); | 449 | mEventEditor = mDialogManager->getEventEditor(); |
450 | mTodoEditor = mDialogManager->getTodoEditor(); | 450 | mTodoEditor = mDialogManager->getTodoEditor(); |
451 | 451 | ||
452 | mFlagEditDescription = false; | 452 | mFlagEditDescription = false; |
453 | 453 | ||
454 | mSuspendTimer = new QTimer( this ); | 454 | mSuspendTimer = new QTimer( this ); |
455 | mAlarmTimer = new QTimer( this ); | 455 | mAlarmTimer = new QTimer( this ); |
456 | mRecheckAlarmTimer = new QTimer( this ); | 456 | mRecheckAlarmTimer = new QTimer( this ); |
457 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 457 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
458 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 458 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
459 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 459 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
460 | mAlarmDialog = new AlarmDialog( this ); | 460 | mAlarmDialog = new AlarmDialog( this ); |
461 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 461 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
462 | mAlarmDialog->setServerNotification( false ); | 462 | mAlarmDialog->setServerNotification( false ); |
463 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 463 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | CalendarView::~CalendarView() | 467 | CalendarView::~CalendarView() |
468 | { | 468 | { |
469 | // kdDebug() << "~CalendarView()" << endl; | 469 | // kdDebug() << "~CalendarView()" << endl; |
470 | //qDebug("CalendarView::~CalendarView() "); | 470 | //qDebug("CalendarView::~CalendarView() "); |
471 | delete mDialogManager; | 471 | delete mDialogManager; |
472 | delete mViewManager; | 472 | delete mViewManager; |
473 | delete mStorage; | 473 | delete mStorage; |
474 | delete mDateFrame ; | 474 | delete mDateFrame ; |
475 | delete beamDialog; | 475 | delete beamDialog; |
476 | //kdDebug() << "~CalendarView() done" << endl; | 476 | //kdDebug() << "~CalendarView() done" << endl; |
477 | } | 477 | } |
478 | void CalendarView::timerAlarm() | 478 | void CalendarView::timerAlarm() |
479 | { | 479 | { |
480 | //qDebug("CalendarView::timerAlarm() "); | 480 | //qDebug("CalendarView::timerAlarm() "); |
481 | computeAlarm(mAlarmNotification ); | 481 | computeAlarm(mAlarmNotification ); |
482 | } | 482 | } |
483 | 483 | ||
484 | void CalendarView::suspendAlarm() | 484 | void CalendarView::suspendAlarm() |
485 | { | 485 | { |
486 | //qDebug(" CalendarView::suspendAlarm() "); | 486 | //qDebug(" CalendarView::suspendAlarm() "); |
487 | computeAlarm(mSuspendAlarmNotification ); | 487 | computeAlarm(mSuspendAlarmNotification ); |
488 | 488 | ||
489 | } | 489 | } |
490 | 490 | ||
491 | void CalendarView::startAlarm( QString mess , QString filename) | 491 | void CalendarView::startAlarm( QString mess , QString filename) |
492 | { | 492 | { |
493 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 493 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
494 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 494 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
495 | 495 | ||
496 | } | 496 | } |
497 | 497 | ||
498 | void CalendarView::checkNextTimerAlarm() | 498 | void CalendarView::checkNextTimerAlarm() |
499 | { | 499 | { |
500 | mCalendar->checkAlarmForIncidence( 0, true ); | 500 | mCalendar->checkAlarmForIncidence( 0, true ); |
501 | } | 501 | } |
502 | 502 | ||
503 | void CalendarView::computeAlarm( QString msg ) | 503 | void CalendarView::computeAlarm( QString msg ) |
504 | { | 504 | { |
505 | 505 | ||
506 | QString mess = msg; | 506 | QString mess = msg; |
507 | QString mAlarmMessage = mess.mid( 9 ); | 507 | QString mAlarmMessage = mess.mid( 9 ); |
508 | QString filename = MainWindow::resourcePath(); | 508 | QString filename = MainWindow::resourcePath(); |
509 | filename += "koalarm.wav"; | 509 | filename += "koalarm.wav"; |
510 | QString tempfilename; | 510 | QString tempfilename; |
511 | if ( mess.left( 13 ) == "suspend_alarm") { | 511 | if ( mess.left( 13 ) == "suspend_alarm") { |
512 | bool error = false; | 512 | bool error = false; |
513 | int len = mess.mid( 13 ).find("+++"); | 513 | int len = mess.mid( 13 ).find("+++"); |
514 | if ( len < 2 ) | 514 | if ( len < 2 ) |
515 | error = true; | 515 | error = true; |
516 | else { | 516 | else { |
517 | tempfilename = mess.mid( 13, len ); | 517 | tempfilename = mess.mid( 13, len ); |
518 | if ( !QFile::exists( tempfilename ) ) | 518 | if ( !QFile::exists( tempfilename ) ) |
519 | error = true; | 519 | error = true; |
520 | } | 520 | } |
521 | if ( ! error ) { | 521 | if ( ! error ) { |
522 | filename = tempfilename; | 522 | filename = tempfilename; |
523 | } | 523 | } |
524 | mAlarmMessage = mess.mid( 13+len+3 ); | 524 | mAlarmMessage = mess.mid( 13+len+3 ); |
525 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 525 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
526 | startAlarm( mAlarmMessage, filename); | 526 | startAlarm( mAlarmMessage, filename); |
527 | return; | 527 | return; |
528 | } | 528 | } |
529 | if ( mess.left( 11 ) == "timer_alarm") { | 529 | if ( mess.left( 11 ) == "timer_alarm") { |
530 | //mTimerTime = 0; | 530 | //mTimerTime = 0; |
531 | startAlarm( mess.mid( 11 ), filename ); | 531 | startAlarm( mess.mid( 11 ), filename ); |
532 | return; | 532 | return; |
533 | } | 533 | } |
534 | if ( mess.left( 10 ) == "proc_alarm") { | 534 | if ( mess.left( 10 ) == "proc_alarm") { |
535 | bool error = false; | 535 | bool error = false; |
536 | int len = mess.mid( 10 ).find("+++"); | 536 | int len = mess.mid( 10 ).find("+++"); |
537 | if ( len < 2 ) | 537 | if ( len < 2 ) |
538 | error = true; | 538 | error = true; |
539 | else { | 539 | else { |
540 | tempfilename = mess.mid( 10, len ); | 540 | tempfilename = mess.mid( 10, len ); |
541 | if ( !QFile::exists( tempfilename ) ) | 541 | if ( !QFile::exists( tempfilename ) ) |
542 | error = true; | 542 | error = true; |
543 | } | 543 | } |
544 | if ( error ) { | 544 | if ( error ) { |
545 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 545 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
546 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 546 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
547 | } else { | 547 | } else { |
548 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 548 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
549 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 549 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
550 | #ifndef _WIN32_ | 550 | #ifndef _WIN32_ |
551 | if ( vfork () == 0 ) { | 551 | if ( vfork () == 0 ) { |
552 | execl ( tempfilename.latin1(), 0 ); | 552 | execl ( tempfilename.latin1(), 0 ); |
553 | return; | 553 | return; |
554 | } | 554 | } |
555 | #else | 555 | #else |
556 | QProcess* p = new QProcess(); | 556 | QProcess* p = new QProcess(); |
557 | p->addArgument( tempfilename.latin1() ); | 557 | p->addArgument( tempfilename.latin1() ); |
558 | p->start(); | 558 | p->start(); |
559 | return; | 559 | return; |
560 | #endif | 560 | #endif |
561 | 561 | ||
562 | return; | 562 | return; |
563 | } | 563 | } |
564 | 564 | ||
565 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 565 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
566 | } | 566 | } |
567 | if ( mess.left( 11 ) == "audio_alarm") { | 567 | if ( mess.left( 11 ) == "audio_alarm") { |
568 | bool error = false; | 568 | bool error = false; |
569 | int len = mess.mid( 11 ).find("+++"); | 569 | int len = mess.mid( 11 ).find("+++"); |
570 | if ( len < 2 ) | 570 | if ( len < 2 ) |
571 | error = true; | 571 | error = true; |
572 | else { | 572 | else { |
573 | tempfilename = mess.mid( 11, len ); | 573 | tempfilename = mess.mid( 11, len ); |
574 | if ( !QFile::exists( tempfilename ) ) | 574 | if ( !QFile::exists( tempfilename ) ) |
575 | error = true; | 575 | error = true; |
576 | } | 576 | } |
577 | if ( ! error ) { | 577 | if ( ! error ) { |
578 | filename = tempfilename; | 578 | filename = tempfilename; |
579 | } | 579 | } |
580 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 580 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
581 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 581 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
582 | } | 582 | } |
583 | if ( mess.left( 9 ) == "cal_alarm") { | 583 | if ( mess.left( 9 ) == "cal_alarm") { |
584 | mAlarmMessage = mess.mid( 9 ) ; | 584 | mAlarmMessage = mess.mid( 9 ) ; |
585 | } | 585 | } |
586 | 586 | ||
587 | startAlarm( mAlarmMessage, filename ); | 587 | startAlarm( mAlarmMessage, filename ); |
588 | 588 | ||
589 | 589 | ||
590 | } | 590 | } |
591 | 591 | ||
592 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 592 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
593 | { | 593 | { |
594 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 594 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
595 | 595 | ||
596 | mSuspendAlarmNotification = noti; | 596 | mSuspendAlarmNotification = noti; |
597 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 597 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
598 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 598 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
599 | mSuspendTimer->start( ms , true ); | 599 | mSuspendTimer->start( ms , true ); |
600 | 600 | ||
601 | } | 601 | } |
602 | 602 | ||
603 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 603 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
604 | { | 604 | { |
605 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 605 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
606 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 606 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
607 | #ifndef DESKTOP_VERSION | 607 | #ifndef DESKTOP_VERSION |
608 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 608 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
609 | #endif | 609 | #endif |
610 | return; | 610 | return; |
611 | } | 611 | } |
612 | int maxSec; | 612 | int maxSec; |
613 | //maxSec = 5; //testing only | 613 | //maxSec = 5; //testing only |
614 | maxSec = 86400+3600; // one day+1hour | 614 | maxSec = 86400+3600; // one day+1hour |
615 | mAlarmNotification = noti; | 615 | mAlarmNotification = noti; |
616 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 616 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
617 | if ( sec > maxSec ) { | 617 | if ( sec > maxSec ) { |
618 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 618 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
619 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 619 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
620 | return; | 620 | return; |
621 | } else { | 621 | } else { |
622 | mRecheckAlarmTimer->stop(); | 622 | mRecheckAlarmTimer->stop(); |
623 | } | 623 | } |
624 | //qDebug("Alarm timer started with secs: %d ", sec); | 624 | //qDebug("Alarm timer started with secs: %d ", sec); |
625 | mAlarmTimer->start( sec *1000 , true ); | 625 | mAlarmTimer->start( sec *1000 , true ); |
626 | 626 | ||
627 | } | 627 | } |
628 | // called by mRecheckAlarmTimer to get next alarm | 628 | // called by mRecheckAlarmTimer to get next alarm |
629 | // we need this, because a QTimer has only a max range of 25 days | 629 | // we need this, because a QTimer has only a max range of 25 days |
630 | void CalendarView::recheckTimerAlarm() | 630 | void CalendarView::recheckTimerAlarm() |
631 | { | 631 | { |
632 | mAlarmTimer->stop(); | 632 | mAlarmTimer->stop(); |
633 | mRecheckAlarmTimer->stop(); | 633 | mRecheckAlarmTimer->stop(); |
634 | mCalendar->checkAlarmForIncidence( 0, true ); | 634 | mCalendar->checkAlarmForIncidence( 0, true ); |
635 | } | 635 | } |
636 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 636 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
637 | { | 637 | { |
638 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 638 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
639 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 639 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
640 | #ifndef DESKTOP_VERSION | 640 | #ifndef DESKTOP_VERSION |
641 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 641 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
642 | #endif | 642 | #endif |
643 | return; | 643 | return; |
644 | } | 644 | } |
645 | mAlarmTimer->stop(); | 645 | mAlarmTimer->stop(); |
646 | } | 646 | } |
647 | void CalendarView::selectWeekNum ( int num ) | 647 | void CalendarView::selectWeekNum ( int num ) |
648 | { | 648 | { |
649 | dateNavigator()->selectWeek( num ); | 649 | dateNavigator()->selectWeek( num ); |
650 | mViewManager->showWeekView(); | 650 | mViewManager->showWeekView(); |
651 | } | 651 | } |
652 | KOViewManager *CalendarView::viewManager() | 652 | KOViewManager *CalendarView::viewManager() |
653 | { | 653 | { |
654 | return mViewManager; | 654 | return mViewManager; |
655 | } | 655 | } |
656 | 656 | ||
657 | KODialogManager *CalendarView::dialogManager() | 657 | KODialogManager *CalendarView::dialogManager() |
658 | { | 658 | { |
659 | return mDialogManager; | 659 | return mDialogManager; |
660 | } | 660 | } |
661 | 661 | ||
662 | QDate CalendarView::startDate() | 662 | QDate CalendarView::startDate() |
663 | { | 663 | { |
664 | DateList dates = mNavigator->selectedDates(); | 664 | DateList dates = mNavigator->selectedDates(); |
665 | 665 | ||
666 | return dates.first(); | 666 | return dates.first(); |
667 | } | 667 | } |
668 | 668 | ||
669 | QDate CalendarView::endDate() | 669 | QDate CalendarView::endDate() |
670 | { | 670 | { |
671 | DateList dates = mNavigator->selectedDates(); | 671 | DateList dates = mNavigator->selectedDates(); |
672 | 672 | ||
673 | return dates.last(); | 673 | return dates.last(); |
674 | } | 674 | } |
675 | 675 | ||
676 | 676 | ||
677 | void CalendarView::createPrinter() | 677 | void CalendarView::createPrinter() |
678 | { | 678 | { |
679 | #ifndef KORG_NOPRINTER | 679 | #ifndef KORG_NOPRINTER |
680 | if (!mCalPrinter) { | 680 | if (!mCalPrinter) { |
681 | mCalPrinter = new CalPrinter(this, mCalendar); | 681 | mCalPrinter = new CalPrinter(this, mCalendar); |
682 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 682 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
683 | } | 683 | } |
684 | #endif | 684 | #endif |
685 | } | 685 | } |
686 | 686 | ||
687 | void CalendarView::confSync() | 687 | void CalendarView::confSync() |
688 | { | 688 | { |
689 | static KSyncPrefsDialog* sp = 0; | 689 | static KSyncPrefsDialog* sp = 0; |
690 | if ( ! sp ) { | 690 | if ( ! sp ) { |
691 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); | 691 | sp = new KSyncPrefsDialog( this, "syncprefs", true ); |
692 | } | 692 | } |
693 | sp->usrReadConfig(); | 693 | sp->usrReadConfig(); |
694 | #ifndef DESKTOP_VERSION | 694 | #ifndef DESKTOP_VERSION |
695 | sp->showMaximized(); | 695 | sp->showMaximized(); |
696 | #else | 696 | #else |
697 | sp->show(); | 697 | sp->show(); |
698 | #endif | 698 | #endif |
699 | sp->exec(); | 699 | sp->exec(); |
700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); | 700 | KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); |
701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); | 701 | KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); |
702 | } | 702 | } |
703 | 703 | ||
704 | 704 | ||
705 | //KOPrefs::instance()->mWriteBackFile | 705 | //KOPrefs::instance()->mWriteBackFile |
706 | //KOPrefs::instance()->mWriteBackExistingOnly | 706 | //KOPrefs::instance()->mWriteBackExistingOnly |
707 | 707 | ||
708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 708 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 709 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 710 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 711 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 712 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 713 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
714 | 714 | ||
715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 715 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
716 | { | 716 | { |
717 | 717 | ||
718 | //void setZaurusId(int id); | 718 | //void setZaurusId(int id); |
719 | // int zaurusId() const; | 719 | // int zaurusId() const; |
720 | // void setZaurusUid(int id); | 720 | // void setZaurusUid(int id); |
721 | // int zaurusUid() const; | 721 | // int zaurusUid() const; |
722 | // void setZaurusStat(int id); | 722 | // void setZaurusStat(int id); |
723 | // int zaurusStat() const; | 723 | // int zaurusStat() const; |
724 | // 0 equal | 724 | // 0 equal |
725 | // 1 take local | 725 | // 1 take local |
726 | // 2 take remote | 726 | // 2 take remote |
727 | // 3 cancel | 727 | // 3 cancel |
728 | QDateTime lastSync = mLastCalendarSync; | 728 | QDateTime lastSync = mLastCalendarSync; |
729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 729 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
730 | bool remCh, locCh; | 730 | bool remCh, locCh; |
731 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 731 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
732 | locCh = ( local->lastModified() > mLastCalendarSync ); | 732 | locCh = ( local->lastModified() > mLastCalendarSync ); |
733 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); | 733 | //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); |
734 | if ( !remCh && ! locCh ) { | 734 | if ( !remCh && ! locCh ) { |
735 | //qDebug("both not changed "); | 735 | //qDebug("both not changed "); |
736 | lastSync = local->lastModified().addDays(1); | 736 | lastSync = local->lastModified().addDays(1); |
737 | } else { | 737 | } else { |
738 | if ( locCh ) { | 738 | if ( locCh ) { |
739 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); | 739 | //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); |
740 | lastSync = local->lastModified().addDays( -1 ); | 740 | lastSync = local->lastModified().addDays( -1 ); |
741 | if ( !remCh ) | 741 | if ( !remCh ) |
742 | remote->setLastModified( lastSync.addDays( -1 ) ); | 742 | remote->setLastModified( lastSync.addDays( -1 ) ); |
743 | } else { | 743 | } else { |
744 | //qDebug(" not loc changed "); | 744 | //qDebug(" not loc changed "); |
745 | lastSync = local->lastModified().addDays( 1 ); | 745 | lastSync = local->lastModified().addDays( 1 ); |
746 | if ( remCh ) | 746 | if ( remCh ) |
747 | remote->setLastModified( lastSync.addDays( 1 ) ); | 747 | remote->setLastModified( lastSync.addDays( 1 ) ); |
748 | 748 | ||
749 | } | 749 | } |
750 | } | 750 | } |
751 | full = true; | 751 | full = true; |
752 | if ( mode < SYNC_PREF_ASK ) | 752 | if ( mode < SYNC_PREF_ASK ) |
753 | mode = SYNC_PREF_ASK; | 753 | mode = SYNC_PREF_ASK; |
754 | } else { | 754 | } else { |
755 | if ( local->lastModified() == remote->lastModified() ) | 755 | if ( local->lastModified() == remote->lastModified() ) |
756 | if ( local->revision() == remote->revision() ) | 756 | if ( local->revision() == remote->revision() ) |
757 | return 0; | 757 | return 0; |
758 | 758 | ||
759 | } | 759 | } |
760 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 760 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
761 | 761 | ||
762 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); | 762 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); |
763 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 763 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
764 | //full = true; //debug only | 764 | //full = true; //debug only |
765 | if ( full ) { | 765 | if ( full ) { |
766 | bool equ = false; | 766 | bool equ = false; |
767 | if ( local->type() == "Event" ) { | 767 | if ( local->type() == "Event" ) { |
768 | equ = (*((Event*) local) == *((Event*) remote)); | 768 | equ = (*((Event*) local) == *((Event*) remote)); |
769 | } | 769 | } |
770 | else if ( local->type() =="Todo" ) | 770 | else if ( local->type() =="Todo" ) |
771 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 771 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
772 | else if ( local->type() =="Journal" ) | 772 | else if ( local->type() =="Journal" ) |
773 | equ = (*((Journal*) local) == *((Journal*) remote)); | 773 | equ = (*((Journal*) local) == *((Journal*) remote)); |
774 | if ( equ ) { | 774 | if ( equ ) { |
775 | //qDebug("equal "); | 775 | //qDebug("equal "); |
776 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 776 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
777 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 777 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
778 | } | 778 | } |
779 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 779 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
780 | return 0; | 780 | return 0; |
781 | 781 | ||
782 | }//else //debug only | 782 | }//else //debug only |
783 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 783 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
784 | } | 784 | } |
785 | int result; | 785 | int result; |
786 | bool localIsNew; | 786 | bool localIsNew; |
787 | if ( full && mode < SYNC_PREF_NEWEST ) | 787 | if ( full && mode < SYNC_PREF_NEWEST ) |
788 | mode = SYNC_PREF_ASK; | 788 | mode = SYNC_PREF_ASK; |
789 | 789 | ||
790 | switch( mode ) { | 790 | switch( mode ) { |
791 | case SYNC_PREF_LOCAL: | 791 | case SYNC_PREF_LOCAL: |
792 | if ( lastSync > remote->lastModified() ) | 792 | if ( lastSync > remote->lastModified() ) |
793 | return 1; | 793 | return 1; |
794 | if ( lastSync > local->lastModified() ) | 794 | if ( lastSync > local->lastModified() ) |
795 | return 2; | 795 | return 2; |
796 | return 1; | 796 | return 1; |
797 | break; | 797 | break; |
798 | case SYNC_PREF_REMOTE: | 798 | case SYNC_PREF_REMOTE: |
799 | if ( lastSync > remote->lastModified() ) | 799 | if ( lastSync > remote->lastModified() ) |
800 | return 1; | 800 | return 1; |
801 | if ( lastSync > local->lastModified() ) | 801 | if ( lastSync > local->lastModified() ) |
802 | return 2; | 802 | return 2; |
803 | return 2; | 803 | return 2; |
804 | break; | 804 | break; |
805 | case SYNC_PREF_NEWEST: | 805 | case SYNC_PREF_NEWEST: |
806 | if ( local->lastModified() > remote->lastModified() ) | 806 | if ( local->lastModified() > remote->lastModified() ) |
807 | return 1; | 807 | return 1; |
808 | else | 808 | else |
809 | return 2; | 809 | return 2; |
810 | break; | 810 | break; |
811 | case SYNC_PREF_ASK: | 811 | case SYNC_PREF_ASK: |
812 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 812 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
813 | if ( lastSync > remote->lastModified() ) | 813 | if ( lastSync > remote->lastModified() ) |
814 | return 1; | 814 | return 1; |
815 | if ( lastSync > local->lastModified() ) | 815 | if ( lastSync > local->lastModified() ) |
816 | return 2; | 816 | return 2; |
817 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 817 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
818 | localIsNew = local->lastModified() > remote->lastModified(); | 818 | localIsNew = local->lastModified() > remote->lastModified(); |
819 | if ( localIsNew ) | 819 | if ( localIsNew ) |
820 | getEventViewerDialog()->setColorMode( 1 ); | 820 | getEventViewerDialog()->setColorMode( 1 ); |
821 | else | 821 | else |
822 | getEventViewerDialog()->setColorMode( 2 ); | 822 | getEventViewerDialog()->setColorMode( 2 ); |
823 | getEventViewerDialog()->setIncidence(local); | 823 | getEventViewerDialog()->setIncidence(local); |
824 | if ( localIsNew ) | 824 | if ( localIsNew ) |
825 | getEventViewerDialog()->setColorMode( 2 ); | 825 | getEventViewerDialog()->setColorMode( 2 ); |
826 | else | 826 | else |
827 | getEventViewerDialog()->setColorMode( 1 ); | 827 | getEventViewerDialog()->setColorMode( 1 ); |
828 | getEventViewerDialog()->addIncidence(remote); | 828 | getEventViewerDialog()->addIncidence(remote); |
829 | getEventViewerDialog()->setColorMode( 0 ); | 829 | getEventViewerDialog()->setColorMode( 0 ); |
830 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 830 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
831 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 831 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
832 | getEventViewerDialog()->showMe(); | 832 | getEventViewerDialog()->showMe(); |
833 | result = getEventViewerDialog()->executeS( localIsNew ); | 833 | result = getEventViewerDialog()->executeS( localIsNew ); |
834 | return result; | 834 | return result; |
835 | 835 | ||
836 | break; | 836 | break; |
837 | case SYNC_PREF_FORCE_LOCAL: | 837 | case SYNC_PREF_FORCE_LOCAL: |
838 | return 1; | 838 | return 1; |
839 | break; | 839 | break; |
840 | case SYNC_PREF_FORCE_REMOTE: | 840 | case SYNC_PREF_FORCE_REMOTE: |
841 | return 2; | 841 | return 2; |
842 | break; | 842 | break; |
843 | 843 | ||
844 | default: | 844 | default: |
845 | // SYNC_PREF_TAKE_BOTH not implemented | 845 | // SYNC_PREF_TAKE_BOTH not implemented |
846 | break; | 846 | break; |
847 | } | 847 | } |
848 | return 0; | 848 | return 0; |
849 | } | 849 | } |
850 | Event* CalendarView::getLastSyncEvent() | 850 | Event* CalendarView::getLastSyncEvent() |
851 | { | 851 | { |
852 | Event* lse; | 852 | Event* lse; |
853 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 853 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
854 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 854 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
855 | if (!lse) { | 855 | if (!lse) { |
856 | lse = new Event(); | 856 | lse = new Event(); |
857 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 857 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
858 | QString sum = ""; | 858 | QString sum = ""; |
859 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 859 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
860 | sum = "E: "; | 860 | sum = "E: "; |
861 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 861 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
862 | lse->setDtStart( mLastCalendarSync ); | 862 | lse->setDtStart( mLastCalendarSync ); |
863 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 863 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
864 | lse->setCategories( i18n("SyncEvent") ); | 864 | lse->setCategories( i18n("SyncEvent") ); |
865 | lse->setReadOnly( true ); | 865 | lse->setReadOnly( true ); |
866 | mCalendar->addEvent( lse ); | 866 | mCalendar->addEvent( lse ); |
867 | } | 867 | } |
868 | 868 | ||
869 | return lse; | 869 | return lse; |
870 | 870 | ||
871 | } | 871 | } |
872 | // probaly useless | 872 | // probaly useless |
873 | void CalendarView::setupExternSyncProfiles() | 873 | void CalendarView::setupExternSyncProfiles() |
874 | { | 874 | { |
875 | Event* lse; | 875 | Event* lse; |
876 | mExternLastSyncEvent.clear(); | 876 | mExternLastSyncEvent.clear(); |
877 | int i; | 877 | int i; |
878 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { | 878 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { |
879 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); | 879 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); |
880 | if ( lse ) | 880 | if ( lse ) |
881 | mExternLastSyncEvent.append( lse ); | 881 | mExternLastSyncEvent.append( lse ); |
882 | else | 882 | else |
883 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); | 883 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); |
884 | } | 884 | } |
885 | 885 | ||
886 | } | 886 | } |
887 | // we check, if the to delete event has a id for a profile | 887 | // we check, if the to delete event has a id for a profile |
888 | // if yes, we set this id in the profile to delete | 888 | // if yes, we set this id in the profile to delete |
889 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 889 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
890 | { | 890 | { |
891 | if ( lastSync.count() == 0 ) { | 891 | if ( lastSync.count() == 0 ) { |
892 | //qDebug(" lastSync.count() == 0"); | 892 | //qDebug(" lastSync.count() == 0"); |
893 | return; | 893 | return; |
894 | } | 894 | } |
895 | if ( toDelete->type() == "Journal" ) | 895 | if ( toDelete->type() == "Journal" ) |
896 | return; | 896 | return; |
897 | 897 | ||
898 | Event* eve = lastSync.first(); | 898 | Event* eve = lastSync.first(); |
899 | 899 | ||
900 | while ( eve ) { | 900 | while ( eve ) { |
901 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 901 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
902 | if ( !id.isEmpty() ) { | 902 | if ( !id.isEmpty() ) { |
903 | QString des = eve->description(); | 903 | QString des = eve->description(); |
904 | QString pref = "e"; | 904 | QString pref = "e"; |
905 | if ( toDelete->type() == "Todo" ) | 905 | if ( toDelete->type() == "Todo" ) |
906 | pref = "t"; | 906 | pref = "t"; |
907 | des += pref+ id + ","; | 907 | des += pref+ id + ","; |
908 | eve->setReadOnly( false ); | 908 | eve->setReadOnly( false ); |
909 | eve->setDescription( des ); | 909 | eve->setDescription( des ); |
910 | //qDebug("setdes %s ", des.latin1()); | 910 | //qDebug("setdes %s ", des.latin1()); |
911 | eve->setReadOnly( true ); | 911 | eve->setReadOnly( true ); |
912 | } | 912 | } |
913 | eve = lastSync.next(); | 913 | eve = lastSync.next(); |
914 | } | 914 | } |
915 | 915 | ||
916 | } | 916 | } |
917 | void CalendarView::checkExternalId( Incidence * inc ) | 917 | void CalendarView::checkExternalId( Incidence * inc ) |
918 | { | 918 | { |
919 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 919 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
920 | checkExternSyncEvent( lastSync, inc ); | 920 | checkExternSyncEvent( lastSync, inc ); |
921 | 921 | ||
922 | } | 922 | } |
923 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 923 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
924 | { | 924 | { |
925 | bool syncOK = true; | 925 | bool syncOK = true; |
926 | int addedEvent = 0; | 926 | int addedEvent = 0; |
927 | int addedEventR = 0; | 927 | int addedEventR = 0; |
928 | int deletedEventR = 0; | 928 | int deletedEventR = 0; |
929 | int deletedEventL = 0; | 929 | int deletedEventL = 0; |
930 | int changedLocal = 0; | 930 | int changedLocal = 0; |
931 | int changedRemote = 0; | 931 | int changedRemote = 0; |
932 | //QPtrList<Event> el = local->rawEvents(); | 932 | //QPtrList<Event> el = local->rawEvents(); |
933 | Event* eventR; | 933 | Event* eventR; |
934 | QString uid; | 934 | QString uid; |
935 | int take; | 935 | int take; |
936 | Event* eventL; | 936 | Event* eventL; |
937 | Event* eventRSync; | 937 | Event* eventRSync; |
938 | Event* eventLSync; | 938 | Event* eventLSync; |
939 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 939 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
940 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 940 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
941 | bool fullDateRange = false; | 941 | bool fullDateRange = false; |
942 | mLastCalendarSync = QDateTime::currentDateTime(); | 942 | mLastCalendarSync = QDateTime::currentDateTime(); |
943 | QDateTime modifiedCalendar = mLastCalendarSync;; | 943 | QDateTime modifiedCalendar = mLastCalendarSync;; |
944 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 944 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
945 | if ( eventR ) { | 945 | if ( eventR ) { |
946 | eventRSync = (Event*) eventR->clone(); | 946 | eventRSync = (Event*) eventR->clone(); |
947 | remote->deleteEvent(eventR ); | 947 | remote->deleteEvent(eventR ); |
948 | 948 | ||
949 | } else { | 949 | } else { |
950 | fullDateRange = true; | 950 | fullDateRange = true; |
951 | eventRSync = new Event(); | 951 | eventRSync = new Event(); |
952 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 952 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
953 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 953 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
954 | eventRSync->setDtStart( mLastCalendarSync ); | 954 | eventRSync->setDtStart( mLastCalendarSync ); |
955 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 955 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
956 | eventRSync->setCategories( i18n("SyncEvent") ); | 956 | eventRSync->setCategories( i18n("SyncEvent") ); |
957 | } | 957 | } |
958 | eventLSync = getLastSyncEvent(); | 958 | eventLSync = getLastSyncEvent(); |
959 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 959 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
960 | fullDateRange = true; | 960 | fullDateRange = true; |
961 | 961 | ||
962 | if ( ! fullDateRange ) { | 962 | if ( ! fullDateRange ) { |
963 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 963 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
964 | 964 | ||
965 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 965 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
966 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 966 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
967 | fullDateRange = true; | 967 | fullDateRange = true; |
968 | } | 968 | } |
969 | } | 969 | } |
970 | if ( fullDateRange ) | 970 | if ( fullDateRange ) |
971 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 971 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
972 | else | 972 | else |
973 | mLastCalendarSync = eventLSync->dtStart(); | 973 | mLastCalendarSync = eventLSync->dtStart(); |
974 | // for resyncing if own file has changed | 974 | // for resyncing if own file has changed |
975 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 975 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
976 | mLastCalendarSync = loadedFileVersion; | 976 | mLastCalendarSync = loadedFileVersion; |
977 | qDebug("setting mLastCalendarSync "); | 977 | qDebug("setting mLastCalendarSync "); |
978 | } | 978 | } |
979 | //qDebug("*************************** "); | 979 | //qDebug("*************************** "); |
980 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); | 980 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); |
981 | QPtrList<Incidence> er = remote->rawIncidences(); | 981 | QPtrList<Incidence> er = remote->rawIncidences(); |
982 | Incidence* inR = er.first(); | 982 | Incidence* inR = er.first(); |
983 | Incidence* inL; | 983 | Incidence* inL; |
984 | QProgressBar bar( er.count(),0 ); | 984 | QProgressBar bar( er.count(),0 ); |
985 | bar.setCaption (i18n("Syncing - close to abort!") ); | 985 | bar.setCaption (i18n("Syncing - close to abort!") ); |
986 | 986 | ||
987 | int w = 300; | 987 | int w = 300; |
988 | if ( QApplication::desktop()->width() < 320 ) | 988 | if ( QApplication::desktop()->width() < 320 ) |
989 | w = 220; | 989 | w = 220; |
990 | int h = bar.sizeHint().height() ; | 990 | int h = bar.sizeHint().height() ; |
991 | int dw = QApplication::desktop()->width(); | 991 | int dw = QApplication::desktop()->width(); |
992 | int dh = QApplication::desktop()->height(); | 992 | int dh = QApplication::desktop()->height(); |
993 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 993 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
994 | bar.show(); | 994 | bar.show(); |
995 | int modulo = (er.count()/10)+1; | 995 | int modulo = (er.count()/10)+1; |
996 | int incCounter = 0; | 996 | int incCounter = 0; |
997 | while ( inR ) { | 997 | while ( inR ) { |
998 | if ( ! bar.isVisible() ) | 998 | if ( ! bar.isVisible() ) |
999 | return false; | 999 | return false; |
1000 | if ( incCounter % modulo == 0 ) | 1000 | if ( incCounter % modulo == 0 ) |
1001 | bar.setProgress( incCounter ); | 1001 | bar.setProgress( incCounter ); |
1002 | ++incCounter; | 1002 | ++incCounter; |
1003 | uid = inR->uid(); | 1003 | uid = inR->uid(); |
1004 | bool skipIncidence = false; | 1004 | bool skipIncidence = false; |
1005 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1005 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1006 | skipIncidence = true; | 1006 | skipIncidence = true; |
1007 | 1007 | ||
1008 | qApp->processEvents(); | 1008 | qApp->processEvents(); |
1009 | if ( !skipIncidence ) { | 1009 | if ( !skipIncidence ) { |
1010 | inL = local->incidence( uid ); | 1010 | inL = local->incidence( uid ); |
1011 | if ( inL ) { // maybe conflict - same uid in both calendars | 1011 | if ( inL ) { // maybe conflict - same uid in both calendars |
1012 | int maxrev = inL->revision(); | 1012 | int maxrev = inL->revision(); |
1013 | if ( maxrev < inR->revision() ) | 1013 | if ( maxrev < inR->revision() ) |
1014 | maxrev = inR->revision(); | 1014 | maxrev = inR->revision(); |
1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1017 | if ( take == 3 ) | 1017 | if ( take == 3 ) |
1018 | return false; | 1018 | return false; |
1019 | if ( take == 1 ) {// take local | 1019 | if ( take == 1 ) {// take local |
1020 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1020 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1021 | remote->deleteIncidence( inR ); | 1021 | remote->deleteIncidence( inR ); |
1022 | if ( inL->revision() < maxrev ) | 1022 | if ( inL->revision() < maxrev ) |
1023 | inL->setRevision( maxrev ); | 1023 | inL->setRevision( maxrev ); |
1024 | remote->addIncidence( inL->clone() ); | 1024 | remote->addIncidence( inL->clone() ); |
1025 | ++changedRemote; | 1025 | ++changedRemote; |
1026 | } else { | 1026 | } else { |
1027 | if ( inR->revision() < maxrev ) | 1027 | if ( inR->revision() < maxrev ) |
1028 | inR->setRevision( maxrev ); | 1028 | inR->setRevision( maxrev ); |
1029 | local->deleteIncidence( inL ); | 1029 | local->deleteIncidence( inL ); |
1030 | local->addIncidence( inR->clone() ); | 1030 | local->addIncidence( inR->clone() ); |
1031 | ++changedLocal; | 1031 | ++changedLocal; |
1032 | } | 1032 | } |
1033 | } | 1033 | } |
1034 | } else { // no conflict | 1034 | } else { // no conflict |
1035 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1035 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1036 | QString des = eventLSync->description(); | 1036 | QString des = eventLSync->description(); |
1037 | QString pref = "e"; | 1037 | QString pref = "e"; |
1038 | if ( inR->type() == "Todo" ) | 1038 | if ( inR->type() == "Todo" ) |
1039 | pref = "t"; | 1039 | pref = "t"; |
1040 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1040 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1041 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1041 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1042 | //remote->deleteIncidence( inR ); | 1042 | //remote->deleteIncidence( inR ); |
1043 | ++deletedEventR; | 1043 | ++deletedEventR; |
1044 | } else { | 1044 | } else { |
1045 | inR->setLastModified( modifiedCalendar ); | 1045 | inR->setLastModified( modifiedCalendar ); |
1046 | local->addIncidence( inR->clone() ); | 1046 | local->addIncidence( inR->clone() ); |
1047 | ++addedEvent; | 1047 | ++addedEvent; |
1048 | } | 1048 | } |
1049 | } else { | 1049 | } else { |
1050 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1050 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1051 | inR->setLastModified( modifiedCalendar ); | 1051 | inR->setLastModified( modifiedCalendar ); |
1052 | local->addIncidence( inR->clone() ); | 1052 | local->addIncidence( inR->clone() ); |
1053 | ++addedEvent; | 1053 | ++addedEvent; |
1054 | } else { | 1054 | } else { |
1055 | checkExternSyncEvent(eventRSyncSharp, inR); | 1055 | checkExternSyncEvent(eventRSyncSharp, inR); |
1056 | remote->deleteIncidence( inR ); | 1056 | remote->deleteIncidence( inR ); |
1057 | ++deletedEventR; | 1057 | ++deletedEventR; |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | } | 1061 | } |
1062 | inR = er.next(); | 1062 | inR = er.next(); |
1063 | } | 1063 | } |
1064 | QPtrList<Incidence> el = local->rawIncidences(); | 1064 | QPtrList<Incidence> el = local->rawIncidences(); |
1065 | inL = el.first(); | 1065 | inL = el.first(); |
1066 | modulo = (el.count()/10)+1; | 1066 | modulo = (el.count()/10)+1; |
1067 | bar.setCaption (i18n("Add / remove events") ); | 1067 | bar.setCaption (i18n("Add / remove events") ); |
1068 | bar.setTotalSteps ( el.count() ) ; | 1068 | bar.setTotalSteps ( el.count() ) ; |
1069 | bar.show(); | 1069 | bar.show(); |
1070 | incCounter = 0; | 1070 | incCounter = 0; |
1071 | 1071 | ||
1072 | while ( inL ) { | 1072 | while ( inL ) { |
1073 | 1073 | ||
1074 | qApp->processEvents(); | 1074 | qApp->processEvents(); |
1075 | if ( ! bar.isVisible() ) | 1075 | if ( ! bar.isVisible() ) |
1076 | return false; | 1076 | return false; |
1077 | if ( incCounter % modulo == 0 ) | 1077 | if ( incCounter % modulo == 0 ) |
1078 | bar.setProgress( incCounter ); | 1078 | bar.setProgress( incCounter ); |
1079 | ++incCounter; | 1079 | ++incCounter; |
1080 | uid = inL->uid(); | 1080 | uid = inL->uid(); |
1081 | bool skipIncidence = false; | 1081 | bool skipIncidence = false; |
1082 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1082 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1083 | skipIncidence = true; | 1083 | skipIncidence = true; |
1084 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1084 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1085 | skipIncidence = true; | 1085 | skipIncidence = true; |
1086 | if ( !skipIncidence ) { | 1086 | if ( !skipIncidence ) { |
1087 | inR = remote->incidence( uid ); | 1087 | inR = remote->incidence( uid ); |
1088 | if ( ! inR ) { | 1088 | if ( ! inR ) { |
1089 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1089 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1090 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1090 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1091 | local->deleteIncidence( inL ); | 1091 | local->deleteIncidence( inL ); |
1092 | ++deletedEventL; | 1092 | ++deletedEventL; |
1093 | } else { | 1093 | } else { |
1094 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1094 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1095 | inL->removeID(mCurrentSyncDevice ); | 1095 | inL->removeID(mCurrentSyncDevice ); |
1096 | ++addedEventR; | 1096 | ++addedEventR; |
1097 | inL->setLastModified( modifiedCalendar ); | 1097 | inL->setLastModified( modifiedCalendar ); |
1098 | remote->addIncidence( inL->clone() ); | 1098 | remote->addIncidence( inL->clone() ); |
1099 | } | 1099 | } |
1100 | } | 1100 | } |
1101 | } else { | 1101 | } else { |
1102 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1102 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1103 | checkExternSyncEvent(eventLSyncSharp, inL); | 1103 | checkExternSyncEvent(eventLSyncSharp, inL); |
1104 | local->deleteIncidence( inL ); | 1104 | local->deleteIncidence( inL ); |
1105 | ++deletedEventL; | 1105 | ++deletedEventL; |
1106 | } else { | 1106 | } else { |
1107 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1107 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1108 | ++addedEventR; | 1108 | ++addedEventR; |
1109 | inL->setLastModified( modifiedCalendar ); | 1109 | inL->setLastModified( modifiedCalendar ); |
1110 | remote->addIncidence( inL->clone() ); | 1110 | remote->addIncidence( inL->clone() ); |
1111 | } | 1111 | } |
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | inL = el.next(); | 1116 | inL = el.next(); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | bar.hide(); | 1119 | bar.hide(); |
1120 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1120 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1121 | eventLSync->setReadOnly( false ); | 1121 | eventLSync->setReadOnly( false ); |
1122 | eventLSync->setDtStart( mLastCalendarSync ); | 1122 | eventLSync->setDtStart( mLastCalendarSync ); |
1123 | eventRSync->setDtStart( mLastCalendarSync ); | 1123 | eventRSync->setDtStart( mLastCalendarSync ); |
1124 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1124 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1125 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1125 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1126 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1126 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1127 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1127 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1128 | eventLSync->setReadOnly( true ); | 1128 | eventLSync->setReadOnly( true ); |
1129 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1129 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1130 | remote->addEvent( eventRSync ); | 1130 | remote->addEvent( eventRSync ); |
1131 | QString mes; | 1131 | QString mes; |
1132 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1132 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1133 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1133 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1134 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1134 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1135 | } | 1135 | } |
1136 | qDebug( mes ); | 1136 | qDebug( mes ); |
1137 | mCalendar->checkAlarmForIncidence( 0, true ); | 1137 | mCalendar->checkAlarmForIncidence( 0, true ); |
1138 | return syncOK; | 1138 | return syncOK; |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | void CalendarView::setSyncDevice( QString s ) | 1141 | void CalendarView::setSyncDevice( QString s ) |
1142 | { | 1142 | { |
1143 | mCurrentSyncDevice= s; | 1143 | mCurrentSyncDevice= s; |
1144 | } | 1144 | } |
1145 | void CalendarView::setSyncName( QString s ) | 1145 | void CalendarView::setSyncName( QString s ) |
1146 | { | 1146 | { |
1147 | mCurrentSyncName= s; | 1147 | mCurrentSyncName= s; |
1148 | } | 1148 | } |
1149 | bool CalendarView::syncCalendar(QString filename, int mode) | 1149 | bool CalendarView::syncCalendar(QString filename, int mode) |
1150 | { | 1150 | { |
1151 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1151 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1152 | CalendarLocal* calendar = new CalendarLocal(); | 1152 | CalendarLocal* calendar = new CalendarLocal(); |
1153 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1153 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1154 | FileStorage* storage = new FileStorage( calendar ); | 1154 | FileStorage* storage = new FileStorage( calendar ); |
1155 | bool syncOK = false; | 1155 | bool syncOK = false; |
1156 | storage->setFileName( filename ); | 1156 | storage->setFileName( filename ); |
1157 | // qDebug("loading ... "); | 1157 | // qDebug("loading ... "); |
1158 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1158 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1159 | getEventViewerDialog()->setSyncMode( true ); | 1159 | getEventViewerDialog()->setSyncMode( true ); |
1160 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1160 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1161 | getEventViewerDialog()->setSyncMode( false ); | 1161 | getEventViewerDialog()->setSyncMode( false ); |
1162 | if ( syncOK ) { | 1162 | if ( syncOK ) { |
1163 | if ( KOPrefs::instance()->mWriteBackFile ) | 1163 | if ( KOPrefs::instance()->mWriteBackFile ) |
1164 | { | 1164 | { |
1165 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1165 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1166 | storage->save(); | 1166 | storage->save(); |
1167 | } | 1167 | } |
1168 | } | 1168 | } |
1169 | setModified( true ); | 1169 | setModified( true ); |
1170 | } | 1170 | } |
1171 | delete storage; | 1171 | delete storage; |
1172 | delete calendar; | 1172 | delete calendar; |
1173 | if ( syncOK ) | 1173 | if ( syncOK ) |
1174 | updateView(); | 1174 | updateView(); |
1175 | return syncOK; | 1175 | return syncOK; |
1176 | } | 1176 | } |
1177 | void CalendarView::syncPhone() | 1177 | void CalendarView::syncPhone() |
1178 | { | 1178 | { |
1179 | syncExternal( 1 ); | 1179 | syncExternal( 1 ); |
1180 | } | 1180 | } |
1181 | void CalendarView::syncExternal( int mode ) | 1181 | void CalendarView::syncExternal( int mode ) |
1182 | { | 1182 | { |
1183 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1183 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1184 | //mCurrentSyncDevice = "sharp-DTM"; | 1184 | //mCurrentSyncDevice = "sharp-DTM"; |
1185 | if ( KOPrefs::instance()->mAskForPreferences ) | 1185 | if ( KOPrefs::instance()->mAskForPreferences ) |
1186 | edit_sync_options(); | 1186 | edit_sync_options(); |
1187 | qApp->processEvents(); | 1187 | qApp->processEvents(); |
1188 | CalendarLocal* calendar = new CalendarLocal(); | 1188 | CalendarLocal* calendar = new CalendarLocal(); |
1189 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1189 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1190 | bool syncOK = false; | 1190 | bool syncOK = false; |
1191 | boo loadSuccess = false; | 1191 | bool loadSuccess = false; |
1192 | PhoneFormat* phoneFormat = 0; | 1192 | PhoneFormat* phoneFormat = 0; |
1193 | #ifndef DESKTOP_VERSION | 1193 | #ifndef DESKTOP_VERSION |
1194 | SharpFormat* sharpFormat = 0; | 1194 | SharpFormat* sharpFormat = 0; |
1195 | if ( mode == 0 ) { // sharp | 1195 | if ( mode == 0 ) { // sharp |
1196 | sharpFormat = new SharpFormat () ; | 1196 | sharpFormat = new SharpFormat () ; |
1197 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1197 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1198 | 1198 | ||
1199 | } else | 1199 | } else |
1200 | #endif | 1200 | #endif |
1201 | if ( mode == 1 ) { // phone | 1201 | if ( mode == 1 ) { // phone |
1202 | phoneFormat = new PhoneFormat (); | 1202 | phoneFormat = new PhoneFormat (); |
1203 | loadSuccess = phoneFormat->load( calendar, mCalendar ); | 1203 | loadSuccess = phoneFormat->load( calendar, mCalendar ); |
1204 | 1204 | ||
1205 | } else | 1205 | } else |
1206 | return; | 1206 | return; |
1207 | if ( loadSuccess ) { | 1207 | if ( loadSuccess ) { |
1208 | getEventViewerDialog()->setSyncMode( true ); | 1208 | getEventViewerDialog()->setSyncMode( true ); |
1209 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1209 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1210 | getEventViewerDialog()->setSyncMode( false ); | 1210 | getEventViewerDialog()->setSyncMode( false ); |
1211 | qApp->processEvents(); | 1211 | qApp->processEvents(); |
1212 | if ( syncOK ) { | 1212 | if ( syncOK ) { |
1213 | if ( KOPrefs::instance()->mWriteBackFile ) | 1213 | if ( KOPrefs::instance()->mWriteBackFile ) |
1214 | { | 1214 | { |
1215 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1215 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1216 | Incidence* inc = iL.first(); | 1216 | Incidence* inc = iL.first(); |
1217 | /* obsolete | 1217 | /* obsolete |
1218 | while ( inc ) { | 1218 | while ( inc ) { |
1219 | inc->setZaurusStat( inc->revision () ); | 1219 | inc->setZaurusStat( inc->revision () ); |
1220 | inc = iL.next(); | 1220 | inc = iL.next(); |
1221 | } | 1221 | } |
1222 | */ | 1222 | */ |
1223 | #ifndef DESKTOP_VERSION | 1223 | #ifndef DESKTOP_VERSION |
1224 | if ( sharpFormat ) | 1224 | if ( sharpFormat ) |
1225 | sharpFormat->save(calendar); | 1225 | sharpFormat->save(calendar); |
1226 | #endif | 1226 | #endif |
1227 | if ( phoneFormat ) | 1227 | if ( phoneFormat ) |
1228 | phoneFormat->save(calendar); | 1228 | phoneFormat->save(calendar); |
1229 | iL = calendar->rawIncidences(); | 1229 | iL = calendar->rawIncidences(); |
1230 | inc = iL.first(); | 1230 | inc = iL.first(); |
1231 | Incidence* loc; | 1231 | Incidence* loc; |
1232 | while ( inc ) { | 1232 | while ( inc ) { |
1233 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1233 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1234 | loc = mCalendar->incidence(inc->uid() ); | 1234 | loc = mCalendar->incidence(inc->uid() ); |
1235 | if ( loc ) { | 1235 | if ( loc ) { |
1236 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1236 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1237 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1237 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1238 | } | 1238 | } |
1239 | } | 1239 | } |
1240 | inc = iL.next(); | 1240 | inc = iL.next(); |
1241 | } | 1241 | } |
1242 | Incidence* lse = getLastSyncEvent(); | 1242 | Incidence* lse = getLastSyncEvent(); |
1243 | if ( lse ) { | 1243 | if ( lse ) { |
1244 | lse->setReadOnly( false ); | 1244 | lse->setReadOnly( false ); |
1245 | lse->setDescription( "" ); | 1245 | lse->setDescription( "" ); |
1246 | lse->setReadOnly( true ); | 1246 | lse->setReadOnly( true ); |
1247 | } | 1247 | } |
1248 | } | 1248 | } |
1249 | } | 1249 | } |
1250 | setModified( true ); | 1250 | setModified( true ); |
1251 | } else { | 1251 | } else { |
1252 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1252 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1253 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1253 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1254 | question, i18n("Ok")) ; | 1254 | question, i18n("Ok")) ; |
1255 | 1255 | ||
1256 | } | 1256 | } |
1257 | delete calendar; | 1257 | delete calendar; |
1258 | updateView(); | 1258 | updateView(); |
1259 | return ;//syncOK; | 1259 | return ;//syncOK; |
1260 | 1260 | ||
1261 | } | 1261 | } |
1262 | void CalendarView::syncSharp() | 1262 | void CalendarView::syncSharp() |
1263 | { | 1263 | { |
1264 | syncExternal( 0 ); | 1264 | syncExternal( 0 ); |
1265 | 1265 | ||
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | 1268 | ||
1269 | #include <kabc/stdaddressbook.h> | 1269 | #include <kabc/stdaddressbook.h> |
1270 | bool CalendarView::importBday() | 1270 | bool CalendarView::importBday() |
1271 | { | 1271 | { |
1272 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1272 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1273 | KABC::AddressBook::Iterator it; | 1273 | KABC::AddressBook::Iterator it; |
1274 | int count = 0; | 1274 | int count = 0; |
1275 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1275 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1276 | ++count; | 1276 | ++count; |
1277 | } | 1277 | } |
1278 | QProgressBar bar(count,0 ); | 1278 | QProgressBar bar(count,0 ); |
1279 | int w = 300; | 1279 | int w = 300; |
1280 | if ( QApplication::desktop()->width() < 320 ) | 1280 | if ( QApplication::desktop()->width() < 320 ) |
1281 | w = 220; | 1281 | w = 220; |
1282 | int h = bar.sizeHint().height() ; | 1282 | int h = bar.sizeHint().height() ; |
1283 | int dw = QApplication::desktop()->width(); | 1283 | int dw = QApplication::desktop()->width(); |
1284 | int dh = QApplication::desktop()->height(); | 1284 | int dh = QApplication::desktop()->height(); |
1285 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1285 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1286 | bar.show(); | 1286 | bar.show(); |
1287 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1287 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1288 | qApp->processEvents(); | 1288 | qApp->processEvents(); |
1289 | count = 0; | 1289 | count = 0; |
1290 | int addCount = 0; | 1290 | int addCount = 0; |
1291 | KCal::Attendee* a = 0; | 1291 | KCal::Attendee* a = 0; |
1292 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1292 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1293 | if ( ! bar.isVisible() ) | 1293 | if ( ! bar.isVisible() ) |
1294 | return false; | 1294 | return false; |
1295 | bar.setProgress( count++ ); | 1295 | bar.setProgress( count++ ); |
1296 | qApp->processEvents(); | 1296 | qApp->processEvents(); |
1297 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1297 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1298 | if ( (*it).birthday().date().isValid() ){ | 1298 | if ( (*it).birthday().date().isValid() ){ |
1299 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1299 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1300 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1300 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1301 | ++addCount; | 1301 | ++addCount; |
1302 | } | 1302 | } |
1303 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1303 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1304 | if ( anni.isValid() ){ | 1304 | if ( anni.isValid() ){ |
1305 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1305 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1306 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1306 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1307 | ++addCount; | 1307 | ++addCount; |
1308 | } | 1308 | } |
1309 | } | 1309 | } |
1310 | updateView(); | 1310 | updateView(); |
1311 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1311 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1312 | return true; | 1312 | return true; |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1315 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1316 | { | 1316 | { |
1317 | //qDebug("addAnni "); | 1317 | //qDebug("addAnni "); |
1318 | Event * ev = new Event(); | 1318 | Event * ev = new Event(); |
1319 | if ( a ) { | 1319 | if ( a ) { |
1320 | ev->addAttendee( a ); | 1320 | ev->addAttendee( a ); |
1321 | } | 1321 | } |
1322 | QString kind; | 1322 | QString kind; |
1323 | if ( birthday ) | 1323 | if ( birthday ) |
1324 | kind = i18n( "Birthday" ); | 1324 | kind = i18n( "Birthday" ); |
1325 | else | 1325 | else |
1326 | kind = i18n( "Anniversary" ); | 1326 | kind = i18n( "Anniversary" ); |
1327 | ev->setSummary( name + " - " + kind ); | 1327 | ev->setSummary( name + " - " + kind ); |
1328 | ev->setOrganizer( "nobody@nowhere" ); | 1328 | ev->setOrganizer( "nobody@nowhere" ); |
1329 | ev->setCategories( kind ); | 1329 | ev->setCategories( kind ); |
1330 | ev->setDtStart( QDateTime(date) ); | 1330 | ev->setDtStart( QDateTime(date) ); |
1331 | ev->setDtEnd( QDateTime(date) ); | 1331 | ev->setDtEnd( QDateTime(date) ); |
1332 | ev->setFloats( true ); | 1332 | ev->setFloats( true ); |
1333 | Recurrence * rec = ev->recurrence(); | 1333 | Recurrence * rec = ev->recurrence(); |
1334 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1334 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1335 | rec->addYearlyNum( date.month() ); | 1335 | rec->addYearlyNum( date.month() ); |
1336 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1336 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1337 | delete ev; | 1337 | delete ev; |
1338 | return false; | 1338 | return false; |
1339 | } | 1339 | } |
1340 | return true; | 1340 | return true; |
1341 | 1341 | ||
1342 | } | 1342 | } |
1343 | bool CalendarView::importQtopia( const QString &categories, | 1343 | bool CalendarView::importQtopia( const QString &categories, |
1344 | const QString &datebook, | 1344 | const QString &datebook, |
1345 | const QString &todolist ) | 1345 | const QString &todolist ) |
1346 | { | 1346 | { |
1347 | 1347 | ||
1348 | QtopiaFormat qtopiaFormat; | 1348 | QtopiaFormat qtopiaFormat; |
1349 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1349 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1350 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1350 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1351 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1351 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1352 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1352 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1353 | 1353 | ||
1354 | updateView(); | 1354 | updateView(); |
1355 | return true; | 1355 | return true; |
1356 | 1356 | ||
1357 | #if 0 | 1357 | #if 0 |
1358 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1358 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1359 | mCurrentSyncDevice = "qtopia-XML"; | 1359 | mCurrentSyncDevice = "qtopia-XML"; |
1360 | if ( KOPrefs::instance()->mAskForPreferences ) | 1360 | if ( KOPrefs::instance()->mAskForPreferences ) |
1361 | edit_sync_options(); | 1361 | edit_sync_options(); |
1362 | qApp->processEvents(); | 1362 | qApp->processEvents(); |
1363 | CalendarLocal* calendar = new CalendarLocal(); | 1363 | CalendarLocal* calendar = new CalendarLocal(); |
1364 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1364 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1365 | bool syncOK = false; | 1365 | bool syncOK = false; |
1366 | QtopiaFormat qtopiaFormat; | 1366 | QtopiaFormat qtopiaFormat; |
1367 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1367 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1368 | bool loadOk = true; | 1368 | bool loadOk = true; |
1369 | if ( !categories.isEmpty() ) | 1369 | if ( !categories.isEmpty() ) |
1370 | loadOk = qtopiaFormat.load( calendar, categories ); | 1370 | loadOk = qtopiaFormat.load( calendar, categories ); |
1371 | if ( loadOk && !datebook.isEmpty() ) | 1371 | if ( loadOk && !datebook.isEmpty() ) |
1372 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1372 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1373 | if ( loadOk && !todolist.isEmpty() ) | 1373 | if ( loadOk && !todolist.isEmpty() ) |
1374 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1374 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1375 | 1375 | ||
1376 | if ( loadOk ) { | 1376 | if ( loadOk ) { |
1377 | getEventViewerDialog()->setSyncMode( true ); | 1377 | getEventViewerDialog()->setSyncMode( true ); |
1378 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1378 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1379 | getEventViewerDialog()->setSyncMode( false ); | 1379 | getEventViewerDialog()->setSyncMode( false ); |
1380 | qApp->processEvents(); | 1380 | qApp->processEvents(); |
1381 | if ( syncOK ) { | 1381 | if ( syncOK ) { |
1382 | if ( KOPrefs::instance()->mWriteBackFile ) | 1382 | if ( KOPrefs::instance()->mWriteBackFile ) |
1383 | { | 1383 | { |
1384 | // write back XML file | 1384 | // write back XML file |
1385 | 1385 | ||
1386 | } | 1386 | } |
1387 | setModified( true ); | 1387 | setModified( true ); |
1388 | } | 1388 | } |
1389 | } else { | 1389 | } else { |
1390 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1390 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1391 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1391 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1392 | question, i18n("Ok")) ; | 1392 | question, i18n("Ok")) ; |
1393 | } | 1393 | } |
1394 | delete calendar; | 1394 | delete calendar; |
1395 | updateView(); | 1395 | updateView(); |
1396 | return syncOK; | 1396 | return syncOK; |
1397 | 1397 | ||
1398 | 1398 | ||
1399 | #endif | 1399 | #endif |
1400 | 1400 | ||
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | void CalendarView::setSyncEventsReadOnly() | 1403 | void CalendarView::setSyncEventsReadOnly() |
1404 | { | 1404 | { |
1405 | Event * ev; | 1405 | Event * ev; |
1406 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1406 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1407 | ev = eL.first(); | 1407 | ev = eL.first(); |
1408 | while ( ev ) { | 1408 | while ( ev ) { |
1409 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1409 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1410 | ev->setReadOnly( true ); | 1410 | ev->setReadOnly( true ); |
1411 | ev = eL.next(); | 1411 | ev = eL.next(); |
1412 | } | 1412 | } |
1413 | } | 1413 | } |
1414 | bool CalendarView::openCalendar(QString filename, bool merge) | 1414 | bool CalendarView::openCalendar(QString filename, bool merge) |
1415 | { | 1415 | { |
1416 | 1416 | ||
1417 | if (filename.isEmpty()) { | 1417 | if (filename.isEmpty()) { |
1418 | return false; | 1418 | return false; |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | if (!QFile::exists(filename)) { | 1421 | if (!QFile::exists(filename)) { |
1422 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1422 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1423 | return false; | 1423 | return false; |
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | globalFlagBlockAgenda = 1; | 1426 | globalFlagBlockAgenda = 1; |
1427 | if (!merge) mCalendar->close(); | 1427 | if (!merge) mCalendar->close(); |
1428 | 1428 | ||
1429 | mStorage->setFileName( filename ); | 1429 | mStorage->setFileName( filename ); |
1430 | 1430 | ||
1431 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1431 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1432 | if ( merge ) ;//setModified( true ); | 1432 | if ( merge ) ;//setModified( true ); |
1433 | else { | 1433 | else { |
1434 | //setModified( true ); | 1434 | //setModified( true ); |
1435 | mViewManager->setDocumentId( filename ); | 1435 | mViewManager->setDocumentId( filename ); |
1436 | mDialogManager->setDocumentId( filename ); | 1436 | mDialogManager->setDocumentId( filename ); |
1437 | mTodoList->setDocumentId( filename ); | 1437 | mTodoList->setDocumentId( filename ); |
1438 | } | 1438 | } |
1439 | globalFlagBlockAgenda = 2; | 1439 | globalFlagBlockAgenda = 2; |
1440 | // if ( getLastSyncEvent() ) | 1440 | // if ( getLastSyncEvent() ) |
1441 | // getLastSyncEvent()->setReadOnly( true ); | 1441 | // getLastSyncEvent()->setReadOnly( true ); |
1442 | mCalendar->reInitAlarmSettings(); | 1442 | mCalendar->reInitAlarmSettings(); |
1443 | setSyncEventsReadOnly(); | 1443 | setSyncEventsReadOnly(); |
1444 | updateUnmanagedViews(); | 1444 | updateUnmanagedViews(); |
1445 | updateView(); | 1445 | updateView(); |
1446 | if ( filename != MainWindow::defaultFileName() ) | 1446 | if ( filename != MainWindow::defaultFileName() ) |
1447 | saveCalendar( MainWindow::defaultFileName() ); | 1447 | saveCalendar( MainWindow::defaultFileName() ); |
1448 | loadedFileVersion = QDateTime::currentDateTime(); | 1448 | loadedFileVersion = QDateTime::currentDateTime(); |
1449 | return true; | 1449 | return true; |
1450 | } else { | 1450 | } else { |
1451 | // while failing to load, the calendar object could | 1451 | // while failing to load, the calendar object could |
1452 | // have become partially populated. Clear it out. | 1452 | // have become partially populated. Clear it out. |
1453 | if ( !merge ) mCalendar->close(); | 1453 | if ( !merge ) mCalendar->close(); |
1454 | 1454 | ||
1455 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1455 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1456 | 1456 | ||
1457 | globalFlagBlockAgenda = 2; | 1457 | globalFlagBlockAgenda = 2; |
1458 | updateView(); | 1458 | updateView(); |
1459 | } | 1459 | } |
1460 | return false; | 1460 | return false; |
1461 | } | 1461 | } |
1462 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1462 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1463 | { | 1463 | { |
1464 | loadedFileVersion = dt; | 1464 | loadedFileVersion = dt; |
1465 | } | 1465 | } |
1466 | bool CalendarView::checkFileChanged(QString fn) | 1466 | bool CalendarView::checkFileChanged(QString fn) |
1467 | { | 1467 | { |
1468 | QFileInfo finf ( fn ); | 1468 | QFileInfo finf ( fn ); |
1469 | if ( !finf.exists() ) | 1469 | if ( !finf.exists() ) |
1470 | return true; | 1470 | return true; |
1471 | QDateTime dt = finf.lastModified (); | 1471 | QDateTime dt = finf.lastModified (); |
1472 | if ( dt <= loadedFileVersion ) | 1472 | if ( dt <= loadedFileVersion ) |
1473 | return false; | 1473 | return false; |
1474 | return true; | 1474 | return true; |
1475 | 1475 | ||
1476 | } | 1476 | } |
1477 | bool CalendarView::checkFileVersion(QString fn) | 1477 | bool CalendarView::checkFileVersion(QString fn) |
1478 | { | 1478 | { |
1479 | QFileInfo finf ( fn ); | 1479 | QFileInfo finf ( fn ); |
1480 | if ( !finf.exists() ) | 1480 | if ( !finf.exists() ) |
1481 | return true; | 1481 | return true; |
1482 | QDateTime dt = finf.lastModified (); | 1482 | QDateTime dt = finf.lastModified (); |
1483 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1483 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1484 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1484 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1485 | if ( dt <= loadedFileVersion ) | 1485 | if ( dt <= loadedFileVersion ) |
1486 | return true; | 1486 | return true; |
1487 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , | 1487 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , |
1488 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1488 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1489 | i18n("Sync+save")); | 1489 | i18n("Sync+save")); |
1490 | 1490 | ||
1491 | if ( km == KMessageBox::Cancel ) | 1491 | if ( km == KMessageBox::Cancel ) |
1492 | return false; | 1492 | return false; |
1493 | if ( km == KMessageBox::Yes ) | 1493 | if ( km == KMessageBox::Yes ) |
1494 | return true; | 1494 | return true; |
1495 | 1495 | ||
1496 | setSyncDevice("deleteaftersync" ); | 1496 | setSyncDevice("deleteaftersync" ); |
1497 | KOPrefs::instance()->mAskForPreferences = true; | 1497 | KOPrefs::instance()->mAskForPreferences = true; |
1498 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1498 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1499 | KOPrefs::instance()->mWriteBackFile = false; | 1499 | KOPrefs::instance()->mWriteBackFile = false; |
1500 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1500 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1501 | KOPrefs::instance()->mShowSyncSummary = false; | 1501 | KOPrefs::instance()->mShowSyncSummary = false; |
1502 | syncCalendar( fn, 3 ); | 1502 | syncCalendar( fn, 3 ); |
1503 | Event * e = getLastSyncEvent(); | 1503 | Event * e = getLastSyncEvent(); |
1504 | mCalendar->deleteEvent ( e ); | 1504 | mCalendar->deleteEvent ( e ); |
1505 | updateView(); | 1505 | updateView(); |
1506 | return true; | 1506 | return true; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | bool CalendarView::saveCalendar( QString filename ) | 1509 | bool CalendarView::saveCalendar( QString filename ) |
1510 | { | 1510 | { |
1511 | 1511 | ||
1512 | // Store back all unsaved data into calendar object | 1512 | // Store back all unsaved data into calendar object |
1513 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1513 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1514 | if ( mViewManager->currentView() ) | 1514 | if ( mViewManager->currentView() ) |
1515 | mViewManager->currentView()->flushView(); | 1515 | mViewManager->currentView()->flushView(); |
1516 | 1516 | ||
1517 | //mStorage->setFileName( filename ); | 1517 | //mStorage->setFileName( filename ); |
1518 | 1518 | ||
1519 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1519 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1520 | mStorage->setFileName( filename ); | 1520 | mStorage->setFileName( filename ); |
1521 | bool success; | 1521 | bool success; |
1522 | success = mStorage->save(); | 1522 | success = mStorage->save(); |
1523 | if ( !success ) { | 1523 | if ( !success ) { |
1524 | return false; | 1524 | return false; |
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | return true; | 1527 | return true; |
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | void CalendarView::closeCalendar() | 1530 | void CalendarView::closeCalendar() |
1531 | { | 1531 | { |
1532 | 1532 | ||
1533 | // child windows no longer valid | 1533 | // child windows no longer valid |
1534 | emit closingDown(); | 1534 | emit closingDown(); |
1535 | 1535 | ||
1536 | mCalendar->close(); | 1536 | mCalendar->close(); |
1537 | setModified(false); | 1537 | setModified(false); |
1538 | updateView(); | 1538 | updateView(); |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | void CalendarView::archiveCalendar() | 1541 | void CalendarView::archiveCalendar() |
1542 | { | 1542 | { |
1543 | mDialogManager->showArchiveDialog(); | 1543 | mDialogManager->showArchiveDialog(); |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | 1546 | ||
1547 | void CalendarView::readSettings() | 1547 | void CalendarView::readSettings() |
1548 | { | 1548 | { |
1549 | 1549 | ||
1550 | 1550 | ||
1551 | // mViewManager->showAgendaView(); | 1551 | // mViewManager->showAgendaView(); |
1552 | QString str; | 1552 | QString str; |
1553 | //qDebug("CalendarView::readSettings() "); | 1553 | //qDebug("CalendarView::readSettings() "); |
1554 | // read settings from the KConfig, supplying reasonable | 1554 | // read settings from the KConfig, supplying reasonable |
1555 | // defaults where none are to be found | 1555 | // defaults where none are to be found |
1556 | KConfig *config = KOGlobals::config(); | 1556 | KConfig *config = KOGlobals::config(); |
1557 | #ifndef KORG_NOSPLITTER | 1557 | #ifndef KORG_NOSPLITTER |
1558 | config->setGroup("KOrganizer Geometry"); | 1558 | config->setGroup("KOrganizer Geometry"); |
1559 | 1559 | ||
1560 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1560 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1561 | if (sizes.count() != 2) { | 1561 | if (sizes.count() != 2) { |
1562 | sizes << mDateNavigator->minimumSizeHint().width(); | 1562 | sizes << mDateNavigator->minimumSizeHint().width(); |
1563 | sizes << 300; | 1563 | sizes << 300; |
1564 | } | 1564 | } |
1565 | mPanner->setSizes(sizes); | 1565 | mPanner->setSizes(sizes); |
1566 | 1566 | ||
1567 | sizes = config->readIntListEntry("Separator2"); | 1567 | sizes = config->readIntListEntry("Separator2"); |
1568 | if ( ( mResourceView && sizes.count() == 4 ) || | 1568 | if ( ( mResourceView && sizes.count() == 4 ) || |
1569 | ( !mResourceView && sizes.count() == 3 ) ) { | 1569 | ( !mResourceView && sizes.count() == 3 ) ) { |
1570 | mLeftSplitter->setSizes(sizes); | 1570 | mLeftSplitter->setSizes(sizes); |
1571 | } | 1571 | } |
1572 | #endif | 1572 | #endif |
1573 | globalFlagBlockAgenda = 1; | 1573 | globalFlagBlockAgenda = 1; |
1574 | mViewManager->showAgendaView(); | 1574 | mViewManager->showAgendaView(); |
1575 | //mViewManager->readSettings( config ); | 1575 | //mViewManager->readSettings( config ); |
1576 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1576 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1577 | readFilterSettings(config); | 1577 | readFilterSettings(config); |
1578 | config->setGroup( "Views" ); | 1578 | config->setGroup( "Views" ); |
1579 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1579 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1580 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1580 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1581 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1581 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1582 | else mNavigator->selectDates( dateCount ); | 1582 | else mNavigator->selectDates( dateCount ); |
1583 | // mViewManager->readSettings( config ); | 1583 | // mViewManager->readSettings( config ); |
1584 | updateConfig(); | 1584 | updateConfig(); |
1585 | globalFlagBlockAgenda = 2; | 1585 | globalFlagBlockAgenda = 2; |
1586 | mViewManager->readSettings( config ); | 1586 | mViewManager->readSettings( config ); |
1587 | #ifdef DESKTOP_VERSION | 1587 | #ifdef DESKTOP_VERSION |
1588 | config->setGroup("WidgetLayout"); | 1588 | config->setGroup("WidgetLayout"); |
1589 | QStringList list; | 1589 | QStringList list; |
1590 | list = config->readListEntry("MainLayout"); | 1590 | list = config->readListEntry("MainLayout"); |
1591 | int x,y,w,h; | 1591 | int x,y,w,h; |
1592 | if ( ! list.isEmpty() ) { | 1592 | if ( ! list.isEmpty() ) { |
1593 | x = list[0].toInt(); | 1593 | x = list[0].toInt(); |
1594 | y = list[1].toInt(); | 1594 | y = list[1].toInt(); |
1595 | w = list[2].toInt(); | 1595 | w = list[2].toInt(); |
1596 | h = list[3].toInt(); | 1596 | h = list[3].toInt(); |
1597 | topLevelWidget()->setGeometry(x,y,w,h); | 1597 | topLevelWidget()->setGeometry(x,y,w,h); |
1598 | 1598 | ||
1599 | } else { | 1599 | } else { |
1600 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1600 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1601 | } | 1601 | } |
1602 | list = config->readListEntry("EditEventLayout"); | 1602 | list = config->readListEntry("EditEventLayout"); |
1603 | if ( ! list.isEmpty() ) { | 1603 | if ( ! list.isEmpty() ) { |
1604 | x = list[0].toInt(); | 1604 | x = list[0].toInt(); |
1605 | y = list[1].toInt(); | 1605 | y = list[1].toInt(); |
1606 | w = list[2].toInt(); | 1606 | w = list[2].toInt(); |
1607 | h = list[3].toInt(); | 1607 | h = list[3].toInt(); |
1608 | mEventEditor->setGeometry(x,y,w,h); | 1608 | mEventEditor->setGeometry(x,y,w,h); |
1609 | 1609 | ||
1610 | } | 1610 | } |
1611 | list = config->readListEntry("EditTodoLayout"); | 1611 | list = config->readListEntry("EditTodoLayout"); |
1612 | if ( ! list.isEmpty() ) { | 1612 | if ( ! list.isEmpty() ) { |
1613 | x = list[0].toInt(); | 1613 | x = list[0].toInt(); |
1614 | y = list[1].toInt(); | 1614 | y = list[1].toInt(); |
1615 | w = list[2].toInt(); | 1615 | w = list[2].toInt(); |
1616 | h = list[3].toInt(); | 1616 | h = list[3].toInt(); |
1617 | mTodoEditor->setGeometry(x,y,w,h); | 1617 | mTodoEditor->setGeometry(x,y,w,h); |
1618 | 1618 | ||
1619 | } | 1619 | } |
1620 | list = config->readListEntry("ViewerLayout"); | 1620 | list = config->readListEntry("ViewerLayout"); |
1621 | if ( ! list.isEmpty() ) { | 1621 | if ( ! list.isEmpty() ) { |
1622 | x = list[0].toInt(); | 1622 | x = list[0].toInt(); |
1623 | y = list[1].toInt(); | 1623 | y = list[1].toInt(); |
1624 | w = list[2].toInt(); | 1624 | w = list[2].toInt(); |
1625 | h = list[3].toInt(); | 1625 | h = list[3].toInt(); |
1626 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1626 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1627 | } | 1627 | } |
1628 | #endif | 1628 | #endif |
1629 | 1629 | ||
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | 1632 | ||
1633 | void CalendarView::writeSettings() | 1633 | void CalendarView::writeSettings() |
1634 | { | 1634 | { |
1635 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1635 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1636 | 1636 | ||
1637 | KConfig *config = KOGlobals::config(); | 1637 | KConfig *config = KOGlobals::config(); |
1638 | 1638 | ||
1639 | #ifndef KORG_NOSPLITTER | 1639 | #ifndef KORG_NOSPLITTER |
1640 | config->setGroup("KOrganizer Geometry"); | 1640 | config->setGroup("KOrganizer Geometry"); |
1641 | 1641 | ||
1642 | QValueList<int> list = mPanner->sizes(); | 1642 | QValueList<int> list = mPanner->sizes(); |
1643 | config->writeEntry("Separator1",list); | 1643 | config->writeEntry("Separator1",list); |
1644 | 1644 | ||
1645 | list = mLeftSplitter->sizes(); | 1645 | list = mLeftSplitter->sizes(); |
1646 | config->writeEntry("Separator2",list); | 1646 | config->writeEntry("Separator2",list); |
1647 | #endif | 1647 | #endif |
1648 | 1648 | ||
1649 | mViewManager->writeSettings( config ); | 1649 | mViewManager->writeSettings( config ); |
1650 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1650 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1651 | mDialogManager->writeSettings( config ); | 1651 | mDialogManager->writeSettings( config ); |
1652 | //KOPrefs::instance()->usrWriteConfig(); | 1652 | //KOPrefs::instance()->usrWriteConfig(); |
1653 | KOPrefs::instance()->writeConfig(); | 1653 | KOPrefs::instance()->writeConfig(); |
1654 | 1654 | ||
1655 | writeFilterSettings(config); | 1655 | writeFilterSettings(config); |
1656 | 1656 | ||
1657 | config->setGroup( "Views" ); | 1657 | config->setGroup( "Views" ); |
1658 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1658 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1659 | 1659 | ||
1660 | #ifdef DESKTOP_VERSION | 1660 | #ifdef DESKTOP_VERSION |
1661 | config->setGroup("WidgetLayout"); | 1661 | config->setGroup("WidgetLayout"); |
1662 | QStringList list ;//= config->readListEntry("MainLayout"); | 1662 | QStringList list ;//= config->readListEntry("MainLayout"); |
1663 | int x,y,w,h; | 1663 | int x,y,w,h; |
1664 | QWidget* wid; | 1664 | QWidget* wid; |
1665 | wid = topLevelWidget(); | 1665 | wid = topLevelWidget(); |
1666 | x = wid->geometry().x(); | 1666 | x = wid->geometry().x(); |
1667 | y = wid->geometry().y(); | 1667 | y = wid->geometry().y(); |
1668 | w = wid->width(); | 1668 | w = wid->width(); |
1669 | h = wid->height(); | 1669 | h = wid->height(); |
1670 | list.clear(); | 1670 | list.clear(); |
1671 | list << QString::number( x ); | 1671 | list << QString::number( x ); |
1672 | list << QString::number( y ); | 1672 | list << QString::number( y ); |
1673 | list << QString::number( w ); | 1673 | list << QString::number( w ); |
1674 | list << QString::number( h ); | 1674 | list << QString::number( h ); |
1675 | config->writeEntry("MainLayout",list ); | 1675 | config->writeEntry("MainLayout",list ); |
1676 | 1676 | ||
1677 | wid = mEventEditor; | 1677 | wid = mEventEditor; |
1678 | x = wid->geometry().x(); | 1678 | x = wid->geometry().x(); |
1679 | y = wid->geometry().y(); | 1679 | y = wid->geometry().y(); |
1680 | w = wid->width(); | 1680 | w = wid->width(); |
1681 | h = wid->height(); | 1681 | h = wid->height(); |
1682 | list.clear(); | 1682 | list.clear(); |
1683 | list << QString::number( x ); | 1683 | list << QString::number( x ); |
1684 | list << QString::number( y ); | 1684 | list << QString::number( y ); |
1685 | list << QString::number( w ); | 1685 | list << QString::number( w ); |
1686 | list << QString::number( h ); | 1686 | list << QString::number( h ); |
1687 | config->writeEntry("EditEventLayout",list ); | 1687 | config->writeEntry("EditEventLayout",list ); |
1688 | 1688 | ||
1689 | wid = mTodoEditor; | 1689 | wid = mTodoEditor; |
1690 | x = wid->geometry().x(); | 1690 | x = wid->geometry().x(); |
1691 | y = wid->geometry().y(); | 1691 | y = wid->geometry().y(); |
1692 | w = wid->width(); | 1692 | w = wid->width(); |
1693 | h = wid->height(); | 1693 | h = wid->height(); |
1694 | list.clear(); | 1694 | list.clear(); |
1695 | list << QString::number( x ); | 1695 | list << QString::number( x ); |
1696 | list << QString::number( y ); | 1696 | list << QString::number( y ); |
1697 | list << QString::number( w ); | 1697 | list << QString::number( w ); |
1698 | list << QString::number( h ); | 1698 | list << QString::number( h ); |
1699 | config->writeEntry("EditTodoLayout",list ); | 1699 | config->writeEntry("EditTodoLayout",list ); |
1700 | wid = getEventViewerDialog(); | 1700 | wid = getEventViewerDialog(); |
1701 | x = wid->geometry().x(); | 1701 | x = wid->geometry().x(); |
1702 | y = wid->geometry().y(); | 1702 | y = wid->geometry().y(); |
1703 | w = wid->width(); | 1703 | w = wid->width(); |
1704 | h = wid->height(); | 1704 | h = wid->height(); |
1705 | list.clear(); | 1705 | list.clear(); |
1706 | list << QString::number( x ); | 1706 | list << QString::number( x ); |
1707 | list << QString::number( y ); | 1707 | list << QString::number( y ); |
1708 | list << QString::number( w ); | 1708 | list << QString::number( w ); |
1709 | list << QString::number( h ); | 1709 | list << QString::number( h ); |
1710 | config->writeEntry("ViewerLayout",list ); | 1710 | config->writeEntry("ViewerLayout",list ); |
1711 | wid = mDialogManager->getSearchDialog(); | 1711 | wid = mDialogManager->getSearchDialog(); |
1712 | if ( wid ) { | 1712 | if ( wid ) { |
1713 | x = wid->geometry().x(); | 1713 | x = wid->geometry().x(); |
1714 | y = wid->geometry().y(); | 1714 | y = wid->geometry().y(); |
1715 | w = wid->width(); | 1715 | w = wid->width(); |
1716 | h = wid->height(); | 1716 | h = wid->height(); |
1717 | list.clear(); | 1717 | list.clear(); |
1718 | list << QString::number( x ); | 1718 | list << QString::number( x ); |
1719 | list << QString::number( y ); | 1719 | list << QString::number( y ); |
1720 | list << QString::number( w ); | 1720 | list << QString::number( w ); |
1721 | list << QString::number( h ); | 1721 | list << QString::number( h ); |
1722 | config->writeEntry("SearchLayout",list ); | 1722 | config->writeEntry("SearchLayout",list ); |
1723 | } | 1723 | } |
1724 | #endif | 1724 | #endif |
1725 | 1725 | ||
1726 | 1726 | ||
1727 | config->sync(); | 1727 | config->sync(); |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | void CalendarView::readFilterSettings(KConfig *config) | 1730 | void CalendarView::readFilterSettings(KConfig *config) |
1731 | { | 1731 | { |
1732 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1732 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1733 | 1733 | ||
1734 | mFilters.clear(); | 1734 | mFilters.clear(); |
1735 | 1735 | ||
1736 | config->setGroup("General"); | 1736 | config->setGroup("General"); |
1737 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1737 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1738 | 1738 | ||
1739 | QStringList::ConstIterator it = filterList.begin(); | 1739 | QStringList::ConstIterator it = filterList.begin(); |
1740 | QStringList::ConstIterator end = filterList.end(); | 1740 | QStringList::ConstIterator end = filterList.end(); |
1741 | while(it != end) { | 1741 | while(it != end) { |
1742 | // kdDebug() << " filter: " << (*it) << endl; | 1742 | // kdDebug() << " filter: " << (*it) << endl; |
1743 | 1743 | ||
1744 | CalFilter *filter; | 1744 | CalFilter *filter; |
1745 | filter = new CalFilter(*it); | 1745 | filter = new CalFilter(*it); |
1746 | config->setGroup("Filter_" + (*it)); | 1746 | config->setGroup("Filter_" + (*it)); |
1747 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1747 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1748 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1748 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1749 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1749 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1750 | mFilters.append(filter); | 1750 | mFilters.append(filter); |
1751 | 1751 | ||
1752 | ++it; | 1752 | ++it; |
1753 | } | 1753 | } |
1754 | 1754 | ||
1755 | if (mFilters.count() == 0) { | 1755 | if (mFilters.count() == 0) { |
1756 | CalFilter *filter = new CalFilter(i18n("Default")); | 1756 | CalFilter *filter = new CalFilter(i18n("Default")); |
1757 | mFilters.append(filter); | 1757 | mFilters.append(filter); |
1758 | } | 1758 | } |
1759 | mFilterView->updateFilters(); | 1759 | mFilterView->updateFilters(); |
1760 | config->setGroup("FilterView"); | 1760 | config->setGroup("FilterView"); |
1761 | 1761 | ||
1762 | mFilterView->blockSignals(true); | 1762 | mFilterView->blockSignals(true); |
1763 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 1763 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
1764 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 1764 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
1765 | mFilterView->blockSignals(false); | 1765 | mFilterView->blockSignals(false); |
1766 | // We do it manually to avoid it being done twice by the above calls | 1766 | // We do it manually to avoid it being done twice by the above calls |
1767 | updateFilter(); | 1767 | updateFilter(); |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | void CalendarView::writeFilterSettings(KConfig *config) | 1770 | void CalendarView::writeFilterSettings(KConfig *config) |
1771 | { | 1771 | { |
1772 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 1772 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
1773 | 1773 | ||
1774 | QStringList filterList; | 1774 | QStringList filterList; |
1775 | 1775 | ||
1776 | CalFilter *filter = mFilters.first(); | 1776 | CalFilter *filter = mFilters.first(); |
1777 | while(filter) { | 1777 | while(filter) { |
1778 | // kdDebug() << " fn: " << filter->name() << endl; | 1778 | // kdDebug() << " fn: " << filter->name() << endl; |
1779 | filterList << filter->name(); | 1779 | filterList << filter->name(); |
1780 | config->setGroup("Filter_" + filter->name()); | 1780 | config->setGroup("Filter_" + filter->name()); |
1781 | config->writeEntry("Criteria",filter->criteria()); | 1781 | config->writeEntry("Criteria",filter->criteria()); |
1782 | config->writeEntry("CategoryList",filter->categoryList()); | 1782 | config->writeEntry("CategoryList",filter->categoryList()); |
1783 | filter = mFilters.next(); | 1783 | filter = mFilters.next(); |
1784 | } | 1784 | } |
1785 | config->setGroup("General"); | 1785 | config->setGroup("General"); |
1786 | config->writeEntry("CalendarFilters",filterList); | 1786 | config->writeEntry("CalendarFilters",filterList); |
1787 | 1787 | ||
1788 | config->setGroup("FilterView"); | 1788 | config->setGroup("FilterView"); |
1789 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1789 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1790 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1790 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1791 | } | 1791 | } |
1792 | 1792 | ||
1793 | 1793 | ||
1794 | void CalendarView::goToday() | 1794 | void CalendarView::goToday() |
1795 | { | 1795 | { |
1796 | mNavigator->selectToday(); | 1796 | mNavigator->selectToday(); |
1797 | } | 1797 | } |
1798 | 1798 | ||
1799 | void CalendarView::goNext() | 1799 | void CalendarView::goNext() |
1800 | { | 1800 | { |
1801 | mNavigator->selectNext(); | 1801 | mNavigator->selectNext(); |
1802 | } | 1802 | } |
1803 | 1803 | ||
1804 | void CalendarView::goPrevious() | 1804 | void CalendarView::goPrevious() |
1805 | { | 1805 | { |
1806 | mNavigator->selectPrevious(); | 1806 | mNavigator->selectPrevious(); |
1807 | } | 1807 | } |
1808 | void CalendarView::goNextMonth() | 1808 | void CalendarView::goNextMonth() |
1809 | { | 1809 | { |
1810 | mNavigator->selectNextMonth(); | 1810 | mNavigator->selectNextMonth(); |
1811 | } | 1811 | } |
1812 | 1812 | ||
1813 | void CalendarView::goPreviousMonth() | 1813 | void CalendarView::goPreviousMonth() |
1814 | { | 1814 | { |
1815 | mNavigator->selectPreviousMonth(); | 1815 | mNavigator->selectPreviousMonth(); |
1816 | } | 1816 | } |
1817 | void CalendarView::writeLocale() | 1817 | void CalendarView::writeLocale() |
1818 | { | 1818 | { |
1819 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 1819 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
1820 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 1820 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
1821 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 1821 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
1822 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 1822 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
1823 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 1823 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
1824 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 1824 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
1825 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 1825 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
1826 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 1826 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
1827 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 1827 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
1828 | KOPrefs::instance()->mDaylightsavingStart, | 1828 | KOPrefs::instance()->mDaylightsavingStart, |
1829 | KOPrefs::instance()->mDaylightsavingEnd ); | 1829 | KOPrefs::instance()->mDaylightsavingEnd ); |
1830 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); | 1830 | KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); |
1831 | } | 1831 | } |
1832 | void CalendarView::updateConfig() | 1832 | void CalendarView::updateConfig() |
1833 | { | 1833 | { |
1834 | writeLocale(); | 1834 | writeLocale(); |
1835 | if ( KOPrefs::instance()->mUseAppColors ) | 1835 | if ( KOPrefs::instance()->mUseAppColors ) |
1836 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 1836 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
1837 | emit configChanged(); | 1837 | emit configChanged(); |
1838 | mTodoList->updateConfig(); | 1838 | mTodoList->updateConfig(); |
1839 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 1839 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
1840 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1840 | mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1841 | // To make the "fill window" configurations work | 1841 | // To make the "fill window" configurations work |
1842 | //mViewManager->raiseCurrentView(); | 1842 | //mViewManager->raiseCurrentView(); |
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | 1845 | ||
1846 | void CalendarView::eventChanged(Event *event) | 1846 | void CalendarView::eventChanged(Event *event) |
1847 | { | 1847 | { |
1848 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 1848 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
1849 | //updateUnmanagedViews(); | 1849 | //updateUnmanagedViews(); |
1850 | } | 1850 | } |
1851 | 1851 | ||
1852 | void CalendarView::eventAdded(Event *event) | 1852 | void CalendarView::eventAdded(Event *event) |
1853 | { | 1853 | { |
1854 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 1854 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
1855 | } | 1855 | } |
1856 | 1856 | ||
1857 | void CalendarView::eventToBeDeleted(Event *) | 1857 | void CalendarView::eventToBeDeleted(Event *) |
1858 | { | 1858 | { |
1859 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 1859 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | void CalendarView::eventDeleted() | 1862 | void CalendarView::eventDeleted() |
1863 | { | 1863 | { |
1864 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 1864 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
1865 | } | 1865 | } |
1866 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 1866 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
1867 | { | 1867 | { |
1868 | changeIncidenceDisplay((Incidence *)which, action); | 1868 | changeIncidenceDisplay((Incidence *)which, action); |
1869 | } | 1869 | } |
1870 | 1870 | ||
1871 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 1871 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
1872 | { | 1872 | { |
1873 | updateUnmanagedViews(); | 1873 | updateUnmanagedViews(); |
1874 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 1874 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
1875 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 1875 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
1876 | mCalendar->checkAlarmForIncidence( 0, true ); | 1876 | mCalendar->checkAlarmForIncidence( 0, true ); |
1877 | if ( mEventViewerDialog ) | 1877 | if ( mEventViewerDialog ) |
1878 | mEventViewerDialog->hide(); | 1878 | mEventViewerDialog->hide(); |
1879 | } | 1879 | } |
1880 | else | 1880 | else |
1881 | mCalendar->checkAlarmForIncidence( which , false ); | 1881 | mCalendar->checkAlarmForIncidence( which , false ); |
1882 | } | 1882 | } |
1883 | 1883 | ||
1884 | // most of the changeEventDisplays() right now just call the view's | 1884 | // most of the changeEventDisplays() right now just call the view's |
1885 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 1885 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
1886 | void CalendarView::changeEventDisplay(Event *which, int action) | 1886 | void CalendarView::changeEventDisplay(Event *which, int action) |
1887 | { | 1887 | { |
1888 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 1888 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
1889 | changeIncidenceDisplay((Incidence *)which, action); | 1889 | changeIncidenceDisplay((Incidence *)which, action); |
1890 | mDateNavigator->updateView(); | 1890 | mDateNavigator->updateView(); |
1891 | //mDialogManager->updateSearchDialog(); | 1891 | //mDialogManager->updateSearchDialog(); |
1892 | 1892 | ||
1893 | if (which) { | 1893 | if (which) { |
1894 | // If there is an event view visible update the display | 1894 | // If there is an event view visible update the display |
1895 | mViewManager->currentView()->changeEventDisplay(which,action); | 1895 | mViewManager->currentView()->changeEventDisplay(which,action); |
1896 | // TODO: check, if update needed | 1896 | // TODO: check, if update needed |
1897 | // if (which->getTodoStatus()) { | 1897 | // if (which->getTodoStatus()) { |
1898 | mTodoList->updateView(); | 1898 | mTodoList->updateView(); |
1899 | // } | 1899 | // } |
1900 | } else { | 1900 | } else { |
1901 | mViewManager->currentView()->updateView(); | 1901 | mViewManager->currentView()->updateView(); |
1902 | } | 1902 | } |
1903 | } | 1903 | } |
1904 | 1904 | ||
1905 | 1905 | ||
1906 | void CalendarView::updateTodoViews() | 1906 | void CalendarView::updateTodoViews() |
1907 | { | 1907 | { |
1908 | 1908 | ||
1909 | mTodoList->updateView(); | 1909 | mTodoList->updateView(); |
1910 | mViewManager->currentView()->updateView(); | 1910 | mViewManager->currentView()->updateView(); |
1911 | 1911 | ||
1912 | } | 1912 | } |
1913 | 1913 | ||
1914 | 1914 | ||
1915 | void CalendarView::updateView(const QDate &start, const QDate &end) | 1915 | void CalendarView::updateView(const QDate &start, const QDate &end) |
1916 | { | 1916 | { |
1917 | mTodoList->updateView(); | 1917 | mTodoList->updateView(); |
1918 | mViewManager->updateView(start, end); | 1918 | mViewManager->updateView(start, end); |
1919 | //mDateNavigator->updateView(); | 1919 | //mDateNavigator->updateView(); |
1920 | } | 1920 | } |
1921 | 1921 | ||
1922 | void CalendarView::updateView() | 1922 | void CalendarView::updateView() |
1923 | { | 1923 | { |
1924 | DateList tmpList = mNavigator->selectedDates(); | 1924 | DateList tmpList = mNavigator->selectedDates(); |
1925 | 1925 | ||
1926 | // We assume that the navigator only selects consecutive days. | 1926 | // We assume that the navigator only selects consecutive days. |
1927 | updateView( tmpList.first(), tmpList.last() ); | 1927 | updateView( tmpList.first(), tmpList.last() ); |
1928 | } | 1928 | } |
1929 | 1929 | ||
1930 | void CalendarView::updateUnmanagedViews() | 1930 | void CalendarView::updateUnmanagedViews() |
1931 | { | 1931 | { |
1932 | mDateNavigator->updateDayMatrix(); | 1932 | mDateNavigator->updateDayMatrix(); |
1933 | } | 1933 | } |
1934 | 1934 | ||
1935 | int CalendarView::msgItemDelete() | 1935 | int CalendarView::msgItemDelete() |
1936 | { | 1936 | { |
1937 | return KMessageBox::warningContinueCancel(this, | 1937 | return KMessageBox::warningContinueCancel(this, |
1938 | i18n("This item will be\npermanently deleted."), | 1938 | i18n("This item will be\npermanently deleted."), |
1939 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 1939 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
1940 | } | 1940 | } |
1941 | 1941 | ||
1942 | 1942 | ||
1943 | void CalendarView::edit_cut() | 1943 | void CalendarView::edit_cut() |
1944 | { | 1944 | { |
1945 | Event *anEvent=0; | 1945 | Event *anEvent=0; |
1946 | 1946 | ||
1947 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 1947 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
1948 | 1948 | ||
1949 | if (mViewManager->currentView()->isEventView()) { | 1949 | if (mViewManager->currentView()->isEventView()) { |
1950 | if ( incidence && incidence->type() == "Event" ) { | 1950 | if ( incidence && incidence->type() == "Event" ) { |
1951 | anEvent = static_cast<Event *>(incidence); | 1951 | anEvent = static_cast<Event *>(incidence); |
1952 | } | 1952 | } |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | if (!anEvent) { | 1955 | if (!anEvent) { |
1956 | KNotifyClient::beep(); | 1956 | KNotifyClient::beep(); |
1957 | return; | 1957 | return; |
1958 | } | 1958 | } |
1959 | DndFactory factory( mCalendar ); | 1959 | DndFactory factory( mCalendar ); |
1960 | factory.cutEvent(anEvent); | 1960 | factory.cutEvent(anEvent); |
1961 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 1961 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
1962 | } | 1962 | } |
1963 | 1963 | ||
1964 | void CalendarView::edit_copy() | 1964 | void CalendarView::edit_copy() |
1965 | { | 1965 | { |
1966 | Event *anEvent=0; | 1966 | Event *anEvent=0; |
1967 | 1967 | ||
1968 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 1968 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
1969 | 1969 | ||
1970 | if (mViewManager->currentView()->isEventView()) { | 1970 | if (mViewManager->currentView()->isEventView()) { |
1971 | if ( incidence && incidence->type() == "Event" ) { | 1971 | if ( incidence && incidence->type() == "Event" ) { |
1972 | anEvent = static_cast<Event *>(incidence); | 1972 | anEvent = static_cast<Event *>(incidence); |
1973 | } | 1973 | } |
1974 | } | 1974 | } |
1975 | 1975 | ||
1976 | if (!anEvent) { | 1976 | if (!anEvent) { |
1977 | KNotifyClient::beep(); | 1977 | KNotifyClient::beep(); |
1978 | return; | 1978 | return; |
1979 | } | 1979 | } |
1980 | DndFactory factory( mCalendar ); | 1980 | DndFactory factory( mCalendar ); |
1981 | factory.copyEvent(anEvent); | 1981 | factory.copyEvent(anEvent); |
1982 | } | 1982 | } |
1983 | 1983 | ||
1984 | void CalendarView::edit_paste() | 1984 | void CalendarView::edit_paste() |
1985 | { | 1985 | { |
1986 | QDate date = mNavigator->selectedDates().first(); | 1986 | QDate date = mNavigator->selectedDates().first(); |
1987 | 1987 | ||
1988 | DndFactory factory( mCalendar ); | 1988 | DndFactory factory( mCalendar ); |
1989 | Event *pastedEvent = factory.pasteEvent( date ); | 1989 | Event *pastedEvent = factory.pasteEvent( date ); |
1990 | 1990 | ||
1991 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 1991 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | void CalendarView::edit_options() | 1994 | void CalendarView::edit_options() |
1995 | { | 1995 | { |
1996 | mDialogManager->showOptionsDialog(); | 1996 | mDialogManager->showOptionsDialog(); |
1997 | //writeSettings(); | 1997 | //writeSettings(); |
1998 | } | 1998 | } |
1999 | void CalendarView::edit_sync_options() | 1999 | void CalendarView::edit_sync_options() |
2000 | { | 2000 | { |
2001 | //mDialogManager->showSyncOptions(); | 2001 | //mDialogManager->showSyncOptions(); |
2002 | //KOPrefs::instance()->mSyncAlgoPrefs | 2002 | //KOPrefs::instance()->mSyncAlgoPrefs |
2003 | QDialog dia( this, "dia", true ); | 2003 | QDialog dia( this, "dia", true ); |
2004 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 2004 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
2005 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 2005 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
2006 | QVBoxLayout lay ( &dia ); | 2006 | QVBoxLayout lay ( &dia ); |
2007 | lay.setSpacing( 2 ); | 2007 | lay.setSpacing( 2 ); |
2008 | lay.setMargin( 3 ); | 2008 | lay.setMargin( 3 ); |
2009 | lay.addWidget(&gr); | 2009 | lay.addWidget(&gr); |
2010 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | 2010 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); |
2011 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | 2011 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); |
2012 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | 2012 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); |
2013 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | 2013 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); |
2014 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | 2014 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); |
2015 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | 2015 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); |
2016 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | 2016 | //QRadioButton both( i18n("Take both on conflict"), &gr ); |
2017 | QPushButton pb ( "OK", &dia); | 2017 | QPushButton pb ( "OK", &dia); |
2018 | lay.addWidget( &pb ); | 2018 | lay.addWidget( &pb ); |
2019 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 2019 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
2020 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { | 2020 | switch ( KOPrefs::instance()->mSyncAlgoPrefs ) { |
2021 | case 0: | 2021 | case 0: |
2022 | loc.setChecked( true); | 2022 | loc.setChecked( true); |
2023 | break; | 2023 | break; |
2024 | case 1: | 2024 | case 1: |
2025 | rem.setChecked( true ); | 2025 | rem.setChecked( true ); |
2026 | break; | 2026 | break; |
2027 | case 2: | 2027 | case 2: |
2028 | newest.setChecked( true); | 2028 | newest.setChecked( true); |
2029 | break; | 2029 | break; |
2030 | case 3: | 2030 | case 3: |
2031 | ask.setChecked( true); | 2031 | ask.setChecked( true); |
2032 | break; | 2032 | break; |
2033 | case 4: | 2033 | case 4: |
2034 | f_loc.setChecked( true); | 2034 | f_loc.setChecked( true); |
2035 | break; | 2035 | break; |
2036 | case 5: | 2036 | case 5: |
2037 | f_rem.setChecked( true); | 2037 | f_rem.setChecked( true); |
2038 | break; | 2038 | break; |
2039 | case 6: | 2039 | case 6: |
2040 | // both.setChecked( true); | 2040 | // both.setChecked( true); |
2041 | break; | 2041 | break; |
2042 | default: | 2042 | default: |
2043 | break; | 2043 | break; |
2044 | } | 2044 | } |
2045 | if ( dia.exec() ) { | 2045 | if ( dia.exec() ) { |
2046 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 2046 | KOPrefs::instance()->mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
2047 | } | 2047 | } |
2048 | 2048 | ||
2049 | } | 2049 | } |
2050 | 2050 | ||
2051 | void CalendarView::slotSelectPickerDate( QDate d) | 2051 | void CalendarView::slotSelectPickerDate( QDate d) |
2052 | { | 2052 | { |
2053 | mDateFrame->hide(); | 2053 | mDateFrame->hide(); |
2054 | if ( mDatePickerMode == 1 ) { | 2054 | if ( mDatePickerMode == 1 ) { |
2055 | mNavigator->slotDaySelect( d ); | 2055 | mNavigator->slotDaySelect( d ); |
2056 | } else if ( mDatePickerMode == 2 ) { | 2056 | } else if ( mDatePickerMode == 2 ) { |
2057 | if ( mMoveIncidence->type() == "Todo" ) { | 2057 | if ( mMoveIncidence->type() == "Todo" ) { |
2058 | Todo * to = (Todo *) mMoveIncidence; | 2058 | Todo * to = (Todo *) mMoveIncidence; |
2059 | QTime tim; | 2059 | QTime tim; |
2060 | if ( to->hasDueDate() ) | 2060 | if ( to->hasDueDate() ) |
2061 | tim = to->dtDue().time(); | 2061 | tim = to->dtDue().time(); |
2062 | else { | 2062 | else { |
2063 | tim = QTime ( 0,0,0 ); | 2063 | tim = QTime ( 0,0,0 ); |
2064 | to->setFloats( true ); | 2064 | to->setFloats( true ); |
2065 | to->setHasDueDate( true ); | 2065 | to->setHasDueDate( true ); |
2066 | } | 2066 | } |
2067 | QDateTime dt ( d,tim ); | 2067 | QDateTime dt ( d,tim ); |
2068 | to->setDtDue( dt ); | 2068 | to->setDtDue( dt ); |
2069 | todoChanged( to ); | 2069 | todoChanged( to ); |
2070 | } else { | 2070 | } else { |
2071 | QTime tim = mMoveIncidence->dtStart().time(); | 2071 | QTime tim = mMoveIncidence->dtStart().time(); |
2072 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2072 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2073 | QDateTime dt ( d,tim ); | 2073 | QDateTime dt ( d,tim ); |
2074 | mMoveIncidence->setDtStart( dt ); | 2074 | mMoveIncidence->setDtStart( dt ); |
2075 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2075 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2076 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2076 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2077 | } | 2077 | } |
2078 | 2078 | ||
2079 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2079 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2080 | } | 2080 | } |
2081 | } | 2081 | } |
2082 | 2082 | ||
2083 | void CalendarView::removeCategories() | 2083 | void CalendarView::removeCategories() |
2084 | { | 2084 | { |
2085 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2085 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2086 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2086 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2087 | QStringList catIncList; | 2087 | QStringList catIncList; |
2088 | QStringList newCatList; | 2088 | QStringList newCatList; |
2089 | Incidence* inc = incList.first(); | 2089 | Incidence* inc = incList.first(); |
2090 | int i; | 2090 | int i; |
2091 | int count = 0; | 2091 | int count = 0; |
2092 | while ( inc ) { | 2092 | while ( inc ) { |
2093 | newCatList.clear(); | 2093 | newCatList.clear(); |
2094 | catIncList = inc->categories() ; | 2094 | catIncList = inc->categories() ; |
2095 | for( i = 0; i< catIncList.count(); ++i ) { | 2095 | for( i = 0; i< catIncList.count(); ++i ) { |
2096 | if ( catList.contains (catIncList[i])) | 2096 | if ( catList.contains (catIncList[i])) |
2097 | newCatList.append( catIncList[i] ); | 2097 | newCatList.append( catIncList[i] ); |
2098 | } | 2098 | } |
2099 | newCatList.sort(); | 2099 | newCatList.sort(); |
2100 | inc->setCategories( newCatList.join(",") ); | 2100 | inc->setCategories( newCatList.join(",") ); |
2101 | inc = incList.next(); | 2101 | inc = incList.next(); |
2102 | } | 2102 | } |
2103 | } | 2103 | } |
2104 | 2104 | ||
2105 | int CalendarView::addCategories() | 2105 | int CalendarView::addCategories() |
2106 | { | 2106 | { |
2107 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2107 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2108 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2108 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2109 | QStringList catIncList; | 2109 | QStringList catIncList; |
2110 | Incidence* inc = incList.first(); | 2110 | Incidence* inc = incList.first(); |
2111 | int i; | 2111 | int i; |
2112 | int count = 0; | 2112 | int count = 0; |
2113 | while ( inc ) { | 2113 | while ( inc ) { |
2114 | catIncList = inc->categories() ; | 2114 | catIncList = inc->categories() ; |
2115 | for( i = 0; i< catIncList.count(); ++i ) { | 2115 | for( i = 0; i< catIncList.count(); ++i ) { |
2116 | if ( !catList.contains (catIncList[i])) { | 2116 | if ( !catList.contains (catIncList[i])) { |
2117 | catList.append( catIncList[i] ); | 2117 | catList.append( catIncList[i] ); |
2118 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2118 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2119 | ++count; | 2119 | ++count; |
2120 | } | 2120 | } |
2121 | } | 2121 | } |
2122 | inc = incList.next(); | 2122 | inc = incList.next(); |
2123 | } | 2123 | } |
2124 | catList.sort(); | 2124 | catList.sort(); |
2125 | KOPrefs::instance()->mCustomCategories = catList; | 2125 | KOPrefs::instance()->mCustomCategories = catList; |
2126 | return count; | 2126 | return count; |
2127 | } | 2127 | } |
2128 | 2128 | ||
2129 | void CalendarView::manageCategories() | 2129 | void CalendarView::manageCategories() |
2130 | { | 2130 | { |
2131 | KOCatPrefs* cp = new KOCatPrefs(); | 2131 | KOCatPrefs* cp = new KOCatPrefs(); |
2132 | cp->show(); | 2132 | cp->show(); |
2133 | int w =cp->sizeHint().width() ; | 2133 | int w =cp->sizeHint().width() ; |
2134 | int h = cp->sizeHint().height() ; | 2134 | int h = cp->sizeHint().height() ; |
2135 | int dw = QApplication::desktop()->width(); | 2135 | int dw = QApplication::desktop()->width(); |
2136 | int dh = QApplication::desktop()->height(); | 2136 | int dh = QApplication::desktop()->height(); |
2137 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2137 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2138 | if ( !cp->exec() ) { | 2138 | if ( !cp->exec() ) { |
2139 | delete cp; | 2139 | delete cp; |
2140 | return; | 2140 | return; |
2141 | } | 2141 | } |
2142 | int count = 0; | 2142 | int count = 0; |
2143 | if ( cp->addCat() ) { | 2143 | if ( cp->addCat() ) { |
2144 | count = addCategories(); | 2144 | count = addCategories(); |
2145 | if ( count ) { | 2145 | if ( count ) { |
2146 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2146 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2147 | writeSettings(); | 2147 | writeSettings(); |
2148 | } | 2148 | } |
2149 | } else { | 2149 | } else { |
2150 | removeCategories(); | 2150 | removeCategories(); |
2151 | updateView(); | 2151 | updateView(); |
2152 | } | 2152 | } |
2153 | delete cp; | 2153 | delete cp; |
2154 | } | 2154 | } |
2155 | 2155 | ||
2156 | void CalendarView::beamIncidence(Incidence * Inc) | 2156 | void CalendarView::beamIncidence(Incidence * Inc) |
2157 | { | 2157 | { |
2158 | QPtrList<Incidence> delSel ; | 2158 | QPtrList<Incidence> delSel ; |
2159 | delSel.append(Inc); | 2159 | delSel.append(Inc); |
2160 | beamIncidenceList( delSel ); | 2160 | beamIncidenceList( delSel ); |
2161 | } | 2161 | } |
2162 | void CalendarView::beamCalendar() | 2162 | void CalendarView::beamCalendar() |
2163 | { | 2163 | { |
2164 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2164 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2165 | //qDebug("beamCalendar() "); | 2165 | //qDebug("beamCalendar() "); |
2166 | beamIncidenceList( delSel ); | 2166 | beamIncidenceList( delSel ); |
2167 | } | 2167 | } |
2168 | void CalendarView::beamFilteredCalendar() | 2168 | void CalendarView::beamFilteredCalendar() |
2169 | { | 2169 | { |
2170 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2170 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2171 | //qDebug("beamFilteredCalendar() "); | 2171 | //qDebug("beamFilteredCalendar() "); |
2172 | beamIncidenceList( delSel ); | 2172 | beamIncidenceList( delSel ); |
2173 | } | 2173 | } |
2174 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2174 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2175 | { | 2175 | { |
2176 | if ( beamDialog->exec () == QDialog::Rejected ) | 2176 | if ( beamDialog->exec () == QDialog::Rejected ) |
2177 | return; | 2177 | return; |
2178 | 2178 | ||
2179 | QString fn = "/tmp/kopibeamfile"; | 2179 | QString fn = "/tmp/kopibeamfile"; |
2180 | QString mes; | 2180 | QString mes; |
2181 | bool createbup = true; | 2181 | bool createbup = true; |
2182 | if ( createbup ) { | 2182 | if ( createbup ) { |
2183 | QString description = "\n"; | 2183 | QString description = "\n"; |
2184 | CalendarLocal* cal = new CalendarLocal(); | 2184 | CalendarLocal* cal = new CalendarLocal(); |
2185 | if ( beamDialog->beamLocal() ) | 2185 | if ( beamDialog->beamLocal() ) |
2186 | cal->setLocalTime(); | 2186 | cal->setLocalTime(); |
2187 | else | 2187 | else |
2188 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 2188 | cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
2189 | Incidence *incidence = delSel.first(); | 2189 | Incidence *incidence = delSel.first(); |
2190 | bool addText = false; | 2190 | bool addText = false; |
2191 | if ( delSel.count() < 10 ) | 2191 | if ( delSel.count() < 10 ) |
2192 | addText = true; | 2192 | addText = true; |
2193 | else { | 2193 | else { |
2194 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2194 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2195 | } | 2195 | } |
2196 | while ( incidence ) { | 2196 | while ( incidence ) { |
2197 | Incidence *in = incidence->clone(); | 2197 | Incidence *in = incidence->clone(); |
2198 | if ( addText ) | 2198 | if ( addText ) |
2199 | description += in->summary() + "\n"; | 2199 | description += in->summary() + "\n"; |
2200 | cal->addIncidence( in ); | 2200 | cal->addIncidence( in ); |
2201 | incidence = delSel.next(); | 2201 | incidence = delSel.next(); |
2202 | } | 2202 | } |
2203 | if ( beamDialog->beamVcal() ) { | 2203 | if ( beamDialog->beamVcal() ) { |
2204 | fn += ".vcs"; | 2204 | fn += ".vcs"; |
2205 | FileStorage storage( cal, fn, new VCalFormat ); | 2205 | FileStorage storage( cal, fn, new VCalFormat ); |
2206 | storage.save(); | 2206 | storage.save(); |
2207 | } else { | 2207 | } else { |
2208 | fn += ".ics"; | 2208 | fn += ".ics"; |
2209 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 2209 | FileStorage storage( cal, fn, new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
2210 | storage.save(); | 2210 | storage.save(); |
2211 | } | 2211 | } |
2212 | delete cal; | 2212 | delete cal; |
2213 | mes = i18n("KO/Pi: Ready for beaming"); | 2213 | mes = i18n("KO/Pi: Ready for beaming"); |
2214 | setCaption(mes); | 2214 | setCaption(mes); |
2215 | 2215 | ||
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro index 727764a..b39de35 100644 --- a/korganizer/korganizerE.pro +++ b/korganizer/korganizerE.pro | |||
@@ -1,149 +1,156 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = kopi | 3 | TARGET = kopi |
4 | OBJECTS_DIR = obj/$(PLATFORM) | 4 | OBJECTS_DIR = obj/$(PLATFORM) |
5 | MOC_DIR = moc/$(PLATFORM) | 5 | MOC_DIR = moc/$(PLATFORM) |
6 | DESTDIR=$(QPEDIR)/bin | 6 | DESTDIR=$(QPEDIR)/bin |
7 | 7 | ||
8 | INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include | 8 | INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../qtcompat ../ interfaces ../kabc $(QPEDIR)/include |
9 | #../libkabcwrap | 9 | #../libkabcwrap |
10 | DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL | 10 | DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL |
11 | DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER | 11 | DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER |
12 | DEFINES += KORG_NOLVALTERNATION | 12 | DEFINES += KORG_NOLVALTERNATION |
13 | #KORG_NOKABC | 13 | #KORG_NOKABC |
14 | LIBS += -lmicrokdepim | 14 | LIBS += -lmicrokdepim |
15 | LIBS += -lmicrokcal | 15 | LIBS += -lmicrokcal |
16 | LIBS += -lmicrokde | 16 | LIBS += -lmicrokde |
17 | LIBS += -lmicroqtcompat | 17 | LIBS += -lmicroqtcompat |
18 | LIBS += -lmicrokabc | 18 | LIBS += -lmicrokabc |
19 | #LIBS += -lmicrokabcwrap | 19 | #LIBS += -lmicrokabcwrap |
20 | |||
21 | #LIBS += $(QPEDIR)/lib/gammu | ||
22 | LIBS += -lmicrogammu | ||
23 | LIBS += -lbluetooth | ||
24 | LIBS += -lsdp | ||
25 | |||
26 | |||
20 | LIBS += -lqpe | 27 | LIBS += -lqpe |
21 | LIBS += -ljpeg | 28 | LIBS += -ljpeg |
22 | LIBS += $(QTOPIALIB) | 29 | LIBS += $(QTOPIALIB) |
23 | LIBS += -L$(QPEDIR)/lib | 30 | LIBS += -L$(QPEDIR)/lib |
24 | 31 | ||
25 | INTERFACES = kofilterview_base.ui | 32 | INTERFACES = kofilterview_base.ui |
26 | #filteredit_base.ui | 33 | #filteredit_base.ui |
27 | 34 | ||
28 | HEADERS = \ | 35 | HEADERS = \ |
29 | wordsgerman.h \ | 36 | wordsgerman.h \ |
30 | filteredit_base.h \ | 37 | filteredit_base.h \ |
31 | alarmclient.h \ | 38 | alarmclient.h \ |
32 | calendarview.h \ | 39 | calendarview.h \ |
33 | customlistviewitem.h \ | 40 | customlistviewitem.h \ |
34 | datenavigator.h \ | 41 | datenavigator.h \ |
35 | docprefs.h \ | 42 | docprefs.h \ |
36 | filtereditdialog.h \ | 43 | filtereditdialog.h \ |
37 | incomingdialog.h \ | 44 | incomingdialog.h \ |
38 | incomingdialog_base.h \ | 45 | incomingdialog_base.h \ |
39 | interfaces/korganizer/baseview.h \ | 46 | interfaces/korganizer/baseview.h \ |
40 | interfaces/korganizer/calendarviewbase.h \ | 47 | interfaces/korganizer/calendarviewbase.h \ |
41 | journalentry.h \ | 48 | journalentry.h \ |
42 | kdateedit.h \ | 49 | kdateedit.h \ |
43 | kdatenavigator.h \ | 50 | kdatenavigator.h \ |
44 | koagenda.h \ | 51 | koagenda.h \ |
45 | koagendaitem.h \ | 52 | koagendaitem.h \ |
46 | koagendaview.h \ | 53 | koagendaview.h \ |
47 | kocounterdialog.h \ | 54 | kocounterdialog.h \ |
48 | kodaymatrix.h \ | 55 | kodaymatrix.h \ |
49 | kodialogmanager.h \ | 56 | kodialogmanager.h \ |
50 | koeditordetails.h \ | 57 | koeditordetails.h \ |
51 | koeditorgeneral.h \ | 58 | koeditorgeneral.h \ |
52 | koeditorgeneralevent.h \ | 59 | koeditorgeneralevent.h \ |
53 | koeditorgeneraltodo.h \ | 60 | koeditorgeneraltodo.h \ |
54 | koeditorrecurrence.h \ | 61 | koeditorrecurrence.h \ |
55 | koeventeditor.h \ | 62 | koeventeditor.h \ |
56 | koeventpopupmenu.h \ | 63 | koeventpopupmenu.h \ |
57 | koeventview.h \ | 64 | koeventview.h \ |
58 | koeventviewer.h \ | 65 | koeventviewer.h \ |
59 | koeventviewerdialog.h \ | 66 | koeventviewerdialog.h \ |
60 | kofilterview.h \ | 67 | kofilterview.h \ |
61 | koglobals.h \ | 68 | koglobals.h \ |
62 | koincidenceeditor.h \ | 69 | koincidenceeditor.h \ |
63 | kojournalview.h \ | 70 | kojournalview.h \ |
64 | kolistview.h \ | 71 | kolistview.h \ |
65 | kolocationbox.h \ | 72 | kolocationbox.h \ |
66 | komonthview.h \ | 73 | komonthview.h \ |
67 | koprefs.h \ | 74 | koprefs.h \ |
68 | koprefsdialog.h \ | 75 | koprefsdialog.h \ |
69 | kotimespanview.h \ | 76 | kotimespanview.h \ |
70 | kotodoeditor.h \ | 77 | kotodoeditor.h \ |
71 | kotodoview.h \ | 78 | kotodoview.h \ |
72 | kotodoviewitem.h \ | 79 | kotodoviewitem.h \ |
73 | koviewmanager.h \ | 80 | koviewmanager.h \ |
74 | kowhatsnextview.h \ | 81 | kowhatsnextview.h \ |
75 | ktimeedit.h \ | 82 | ktimeedit.h \ |
76 | lineview.h \ | 83 | lineview.h \ |
77 | mainwindow.h \ | 84 | mainwindow.h \ |
78 | navigatorbar.h \ | 85 | navigatorbar.h \ |
79 | outgoingdialog.h \ | 86 | outgoingdialog.h \ |
80 | outgoingdialog_base.h \ | 87 | outgoingdialog_base.h \ |
81 | publishdialog.h \ | 88 | publishdialog.h \ |
82 | publishdialog_base.h \ | 89 | publishdialog_base.h \ |
83 | savetemplatedialog.h \ | 90 | savetemplatedialog.h \ |
84 | searchdialog.h \ | 91 | searchdialog.h \ |
85 | simplealarmclient.h \ | 92 | simplealarmclient.h \ |
86 | statusdialog.h \ | 93 | statusdialog.h \ |
87 | timeline.h \ | 94 | timeline.h \ |
88 | timespanview.h \ | 95 | timespanview.h \ |
89 | version.h \ | 96 | version.h \ |
90 | ../kalarmd/alarmdialog.h | 97 | ../kalarmd/alarmdialog.h |
91 | 98 | ||
92 | SOURCES = \ | 99 | SOURCES = \ |
93 | filteredit_base.cpp \ | 100 | filteredit_base.cpp \ |
94 | calendarview.cpp \ | 101 | calendarview.cpp \ |
95 | datenavigator.cpp \ | 102 | datenavigator.cpp \ |
96 | docprefs.cpp \ | 103 | docprefs.cpp \ |
97 | filtereditdialog.cpp \ | 104 | filtereditdialog.cpp \ |
98 | incomingdialog.cpp \ | 105 | incomingdialog.cpp \ |
99 | incomingdialog_base.cpp \ | 106 | incomingdialog_base.cpp \ |
100 | journalentry.cpp \ | 107 | journalentry.cpp \ |
101 | kdatenavigator.cpp \ | 108 | kdatenavigator.cpp \ |
102 | koagenda.cpp \ | 109 | koagenda.cpp \ |
103 | koagendaitem.cpp \ | 110 | koagendaitem.cpp \ |
104 | koagendaview.cpp \ | 111 | koagendaview.cpp \ |
105 | kocounterdialog.cpp \ | 112 | kocounterdialog.cpp \ |
106 | kodaymatrix.cpp \ | 113 | kodaymatrix.cpp \ |
107 | kodialogmanager.cpp \ | 114 | kodialogmanager.cpp \ |
108 | koeditordetails.cpp \ | 115 | koeditordetails.cpp \ |
109 | koeditorgeneral.cpp \ | 116 | koeditorgeneral.cpp \ |
110 | koeditorgeneralevent.cpp \ | 117 | koeditorgeneralevent.cpp \ |
111 | koeditorgeneraltodo.cpp \ | 118 | koeditorgeneraltodo.cpp \ |
112 | koeditorrecurrence.cpp \ | 119 | koeditorrecurrence.cpp \ |
113 | koeventeditor.cpp \ | 120 | koeventeditor.cpp \ |
114 | koeventpopupmenu.cpp \ | 121 | koeventpopupmenu.cpp \ |
115 | koeventview.cpp \ | 122 | koeventview.cpp \ |
116 | koeventviewer.cpp \ | 123 | koeventviewer.cpp \ |
117 | koeventviewerdialog.cpp \ | 124 | koeventviewerdialog.cpp \ |
118 | kofilterview.cpp \ | 125 | kofilterview.cpp \ |
119 | koglobals.cpp \ | 126 | koglobals.cpp \ |
120 | koincidenceeditor.cpp \ | 127 | koincidenceeditor.cpp \ |
121 | kojournalview.cpp \ | 128 | kojournalview.cpp \ |
122 | kolistview.cpp \ | 129 | kolistview.cpp \ |
123 | kolocationbox.cpp \ | 130 | kolocationbox.cpp \ |
124 | komonthview.cpp \ | 131 | komonthview.cpp \ |
125 | koprefs.cpp \ | 132 | koprefs.cpp \ |
126 | koprefsdialog.cpp \ | 133 | koprefsdialog.cpp \ |
127 | kotimespanview.cpp \ | 134 | kotimespanview.cpp \ |
128 | kotodoeditor.cpp \ | 135 | kotodoeditor.cpp \ |
129 | kotodoview.cpp \ | 136 | kotodoview.cpp \ |
130 | kotodoviewitem.cpp \ | 137 | kotodoviewitem.cpp \ |
131 | koviewmanager.cpp \ | 138 | koviewmanager.cpp \ |
132 | kowhatsnextview.cpp \ | 139 | kowhatsnextview.cpp \ |
133 | ktimeedit.cpp \ | 140 | ktimeedit.cpp \ |
134 | lineview.cpp \ | 141 | lineview.cpp \ |
135 | main.cpp \ | 142 | main.cpp \ |
136 | mainwindow.cpp \ | 143 | mainwindow.cpp \ |
137 | navigatorbar.cpp \ | 144 | navigatorbar.cpp \ |
138 | outgoingdialog.cpp \ | 145 | outgoingdialog.cpp \ |
139 | outgoingdialog_base.cpp \ | 146 | outgoingdialog_base.cpp \ |
140 | publishdialog.cpp \ | 147 | publishdialog.cpp \ |
141 | publishdialog_base.cpp \ | 148 | publishdialog_base.cpp \ |
142 | savetemplatedialog.cpp \ | 149 | savetemplatedialog.cpp \ |
143 | searchdialog.cpp \ | 150 | searchdialog.cpp \ |
144 | simplealarmclient.cpp \ | 151 | simplealarmclient.cpp \ |
145 | statusdialog.cpp \ | 152 | statusdialog.cpp \ |
146 | timeline.cpp \ | 153 | timeline.cpp \ |
147 | timespanview.cpp \ | 154 | timespanview.cpp \ |
148 | ../kalarmd/alarmdialog.cpp | 155 | ../kalarmd/alarmdialog.cpp |
149 | 156 | ||
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index f78730d..fa18683 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -1,1359 +1,1364 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | #include <qxml.h> | 32 | #include <qxml.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | 34 | ||
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | 38 | ||
39 | #include "calendar.h" | 39 | #include "calendar.h" |
40 | #include "alarm.h" | 40 | #include "alarm.h" |
41 | #include "recurrence.h" | 41 | #include "recurrence.h" |
42 | #include "calendarlocal.h" | 42 | #include "calendarlocal.h" |
43 | 43 | ||
44 | #include "phoneformat.h" | 44 | #include "phoneformat.h" |
45 | 45 | ||
46 | using namespace KCal; | 46 | using namespace KCal; |
47 | 47 | ||
48 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY | 48 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY |
49 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 49 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
50 | 50 | ||
51 | //ARSD silentalarm = 0 | 51 | //ARSD silentalarm = 0 |
52 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly | 52 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly |
53 | // 12 RFRQ | 53 | // 12 RFRQ |
54 | // 13 RPOS pos = 4. monday in month | 54 | // 13 RPOS pos = 4. monday in month |
55 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun | 55 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun |
56 | // 15 REND 0 = no end/ 1 = end | 56 | // 15 REND 0 = no end/ 1 = end |
57 | // 16 REDT rec end dt | 57 | // 16 REDT rec end dt |
58 | //ALSD | 58 | //ALSD |
59 | //ALED | 59 | //ALED |
60 | //MDAY | 60 | //MDAY |
61 | 61 | ||
62 | class SharpParser : public QObject | 62 | class PhoneParser : public QObject |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | SharpParser( Calendar *calendar ) : mCalendar( calendar ) { | 65 | PhoneParser( Calendar *calendar ) : mCalendar( calendar ) { |
66 | oldCategories = 0; | 66 | oldCategories = 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) | 69 | bool startElement( Calendar *existingCalendar, const QStringList & attList, QString qName ) |
70 | { | 70 | { |
71 | int i = 1; | 71 | int i = 1; |
72 | bool skip = true; | 72 | bool skip = true; |
73 | int max = attList.count() -2; | 73 | int max = attList.count() -2; |
74 | while ( i < max ) { | 74 | while ( i < max ) { |
75 | if ( !attList[i].isEmpty() ) { | 75 | if ( !attList[i].isEmpty() ) { |
76 | skip = false; | 76 | skip = false; |
77 | break; | 77 | break; |
78 | } | 78 | } |
79 | ++i ; | 79 | ++i ; |
80 | } | 80 | } |
81 | if ( skip ) | 81 | if ( skip ) |
82 | return false; | 82 | return false; |
83 | ulong cSum = SharpFormat::getCsum(attList ); | 83 | ulong cSum = PhoneFormat::getCsum(attList ); |
84 | 84 | ||
85 | if ( qName == "Event" ) { | 85 | if ( qName == "Event" ) { |
86 | Event *event; | 86 | Event *event; |
87 | event = existingCalendar->event( attList[0].toInt() ); | 87 | event = existingCalendar->event( attList[0] ); |
88 | if ( event ) | 88 | if ( event ) |
89 | event = (Event*)event->clone(); | 89 | event = (Event*)event->clone(); |
90 | else | 90 | else |
91 | event = new Event; | 91 | event = new Event; |
92 | event->setZaurusId( attList[0].toInt() ); | 92 | // event->setZaurusId( attList[0].toInt() ); |
93 | event->setZaurusUid( cSum ); | 93 | //event->setZaurusUid( cSum ); |
94 | event->setZaurusStat( -2 ); | 94 | //event->setZaurusStat( -2 ); |
95 | 95 | ||
96 | event->setSummary( attList[2] ); | 96 | event->setSummary( attList[2] ); |
97 | event->setLocation( attList[3] ); | 97 | event->setLocation( attList[3] ); |
98 | event->setDescription( attList[4] ); | 98 | event->setDescription( attList[4] ); |
99 | if ( attList[7] == "1" ) { | 99 | if ( attList[7] == "1" ) { |
100 | event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) )); | 100 | event->setDtStart( QDateTime(fromString( attList[17]+"T000000", false ).date(),QTime(0,0,0 ) )); |
101 | event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 ))); | 101 | event->setDtEnd( QDateTime(fromString( attList[18]+"T000000", false ).date(),QTime(0,0,0 ))); |
102 | event->setFloats( true ); | 102 | event->setFloats( true ); |
103 | } else { | 103 | } else { |
104 | event->setFloats( false ); | 104 | event->setFloats( false ); |
105 | event->setDtStart( fromString( attList[5] ) ); | 105 | event->setDtStart( fromString( attList[5] ) ); |
106 | event->setDtEnd( fromString( attList[6] )); | 106 | event->setDtEnd( fromString( attList[6] )); |
107 | } | 107 | } |
108 | 108 | ||
109 | QString rtype = attList[11]; | 109 | QString rtype = attList[11]; |
110 | if ( rtype != "255" ) { | 110 | if ( rtype != "255" ) { |
111 | // qDebug("recurs "); | 111 | // qDebug("recurs "); |
112 | QDate startDate = event->dtStart().date(); | 112 | QDate startDate = event->dtStart().date(); |
113 | 113 | ||
114 | QString freqStr = attList[12]; | 114 | QString freqStr = attList[12]; |
115 | int freq = freqStr.toInt(); | 115 | int freq = freqStr.toInt(); |
116 | 116 | ||
117 | QString hasEndDateStr = attList[15] ; | 117 | QString hasEndDateStr = attList[15] ; |
118 | bool hasEndDate = hasEndDateStr == "1"; | 118 | bool hasEndDate = hasEndDateStr == "1"; |
119 | 119 | ||
120 | QString endDateStr = attList[16]; | 120 | QString endDateStr = attList[16]; |
121 | QDate endDate = fromString( endDateStr ).date(); | 121 | QDate endDate = fromString( endDateStr ).date(); |
122 | 122 | ||
123 | QString weekDaysStr = attList[14]; | 123 | QString weekDaysStr = attList[14]; |
124 | uint weekDaysNum = weekDaysStr.toInt(); | 124 | uint weekDaysNum = weekDaysStr.toInt(); |
125 | 125 | ||
126 | QBitArray weekDays( 7 ); | 126 | QBitArray weekDays( 7 ); |
127 | int i; | 127 | int i; |
128 | int bb = 1; | 128 | int bb = 1; |
129 | for( i = 1; i <= 7; ++i ) { | 129 | for( i = 1; i <= 7; ++i ) { |
130 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); | 130 | weekDays.setBit( i - 1, ( bb & weekDaysNum )); |
131 | bb = 2 << (i-1); | 131 | bb = 2 << (i-1); |
132 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); | 132 | //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); |
133 | } | 133 | } |
134 | // qDebug("next "); | 134 | // qDebug("next "); |
135 | QString posStr = attList[13]; | 135 | QString posStr = attList[13]; |
136 | int pos = posStr.toInt(); | 136 | int pos = posStr.toInt(); |
137 | Recurrence *r = event->recurrence(); | 137 | Recurrence *r = event->recurrence(); |
138 | 138 | ||
139 | if ( rtype == "0" ) { | 139 | if ( rtype == "0" ) { |
140 | if ( hasEndDate ) r->setDaily( freq, endDate ); | 140 | if ( hasEndDate ) r->setDaily( freq, endDate ); |
141 | else r->setDaily( freq, -1 ); | 141 | else r->setDaily( freq, -1 ); |
142 | } else if ( rtype == "1" ) { | 142 | } else if ( rtype == "1" ) { |
143 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); | 143 | if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); |
144 | else r->setWeekly( freq, weekDays, -1 ); | 144 | else r->setWeekly( freq, weekDays, -1 ); |
145 | } else if ( rtype == "3" ) { | 145 | } else if ( rtype == "3" ) { |
146 | if ( hasEndDate ) | 146 | if ( hasEndDate ) |
147 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 147 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
148 | else | 148 | else |
149 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); | 149 | r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); |
150 | r->addMonthlyDay( startDate.day() ); | 150 | r->addMonthlyDay( startDate.day() ); |
151 | } else if ( rtype == "2" ) { | 151 | } else if ( rtype == "2" ) { |
152 | if ( hasEndDate ) | 152 | if ( hasEndDate ) |
153 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 153 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
154 | else | 154 | else |
155 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 155 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
156 | QBitArray days( 7 ); | 156 | QBitArray days( 7 ); |
157 | days.fill( false ); | 157 | days.fill( false ); |
158 | days.setBit( startDate.dayOfWeek() - 1 ); | 158 | days.setBit( startDate.dayOfWeek() - 1 ); |
159 | r->addMonthlyPos( pos, days ); | 159 | r->addMonthlyPos( pos, days ); |
160 | } else if ( rtype == "4" ) { | 160 | } else if ( rtype == "4" ) { |
161 | if ( hasEndDate ) | 161 | if ( hasEndDate ) |
162 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 162 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
163 | else | 163 | else |
164 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 164 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
165 | r->addYearlyNum( startDate.month() ); | 165 | r->addYearlyNum( startDate.month() ); |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | QString categoryList = attList[1] ; | 169 | QString categoryList = attList[1] ; |
170 | event->setCategories( lookupCategories( categoryList ) ); | 170 | event->setCategories( lookupCategories( categoryList ) ); |
171 | 171 | ||
172 | // strange 0 semms to mean: alarm enabled | 172 | // strange 0 semms to mean: alarm enabled |
173 | if ( attList[8] == "0" ) { | 173 | if ( attList[8] == "0" ) { |
174 | Alarm *alarm; | 174 | Alarm *alarm; |
175 | if ( event->alarms().count() > 0 ) | 175 | if ( event->alarms().count() > 0 ) |
176 | alarm = event->alarms().first(); | 176 | alarm = event->alarms().first(); |
177 | else { | 177 | else { |
178 | alarm = new Alarm( event ); | 178 | alarm = new Alarm( event ); |
179 | event->addAlarm( alarm ); | 179 | event->addAlarm( alarm ); |
180 | } | 180 | } |
181 | alarm->setType( Alarm::Audio ); | 181 | alarm->setType( Alarm::Audio ); |
182 | alarm->setEnabled( true ); | 182 | alarm->setEnabled( true ); |
183 | int alarmOffset = attList[9].toInt(); | 183 | int alarmOffset = attList[9].toInt(); |
184 | alarm->setStartOffset( alarmOffset * -60 ); | 184 | alarm->setStartOffset( alarmOffset * -60 ); |
185 | } | 185 | } |
186 | 186 | ||
187 | mCalendar->addEvent( event); | 187 | mCalendar->addEvent( event); |
188 | } else if ( qName == "Todo" ) { | 188 | } else if ( qName == "Todo" ) { |
189 | Todo *todo; | 189 | Todo *todo; |
190 | 190 | ||
191 | todo = existingCalendar->todo( attList[0].toInt() ); | 191 | todo = existingCalendar->todo( attList[0] ); |
192 | if (todo ) | 192 | if (todo ) |
193 | todo = (Todo*)todo->clone(); | 193 | todo = (Todo*)todo->clone(); |
194 | else | 194 | else |
195 | todo = new Todo; | 195 | todo = new Todo; |
196 | 196 | ||
197 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 | 197 | //CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1 |
198 | // 0 1 2 3 4 5 6 7 8 | 198 | // 0 1 2 3 4 5 6 7 8 |
199 | //1,,,,,1,4,Loch zumachen,"" | 199 | //1,,,,,1,4,Loch zumachen,"" |
200 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " | 200 | //3,Privat,20040317T000000,20040318T000000,20040319T000000,0,5,Call bbb,"notes123 bbb gggg ""bb "" " |
201 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes | 201 | //2,"Familie,Freunde,Holiday",20040318T000000,20040324T000000,20040317T000000,1,2,tod2,notes |
202 | 202 | ||
203 | todo->setZaurusId( attList[0].toInt() ); | 203 | //todo->setZaurusId( attList[0] ); |
204 | todo->setZaurusUid( cSum ); | 204 | //todo->setZaurusUid( cSum ); |
205 | todo->setZaurusStat( -2 ); | 205 | //todo->setZaurusStat( -2 ); |
206 | 206 | ||
207 | todo->setSummary( attList[7] ); | 207 | todo->setSummary( attList[7] ); |
208 | todo->setDescription( attList[8]); | 208 | todo->setDescription( attList[8]); |
209 | 209 | ||
210 | int priority = attList[6].toInt(); | 210 | int priority = attList[6].toInt(); |
211 | if ( priority == 0 ) priority = 3; | 211 | if ( priority == 0 ) priority = 3; |
212 | todo->setPriority( priority ); | 212 | todo->setPriority( priority ); |
213 | 213 | ||
214 | QString categoryList = attList[1]; | 214 | QString categoryList = attList[1]; |
215 | todo->setCategories( lookupCategories( categoryList ) ); | 215 | todo->setCategories( lookupCategories( categoryList ) ); |
216 | 216 | ||
217 | 217 | ||
218 | 218 | ||
219 | QString hasDateStr = attList[3]; // due | 219 | QString hasDateStr = attList[3]; // due |
220 | if ( !hasDateStr.isEmpty() ) { | 220 | if ( !hasDateStr.isEmpty() ) { |
221 | if ( hasDateStr.right(6) == "000000" ) { | 221 | if ( hasDateStr.right(6) == "000000" ) { |
222 | todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); | 222 | todo->setDtDue( QDateTime(fromString( hasDateStr, false ).date(), QTime(0,0,0 )) ); |
223 | todo->setFloats( true ); | 223 | todo->setFloats( true ); |
224 | } | 224 | } |
225 | else { | 225 | else { |
226 | todo->setDtDue( fromString( hasDateStr ) ); | 226 | todo->setDtDue( fromString( hasDateStr ) ); |
227 | todo->setFloats( false ); | 227 | todo->setFloats( false ); |
228 | } | 228 | } |
229 | 229 | ||
230 | todo->setHasDueDate( true ); | 230 | todo->setHasDueDate( true ); |
231 | } | 231 | } |
232 | hasDateStr = attList[2];//start | 232 | hasDateStr = attList[2];//start |
233 | if ( !hasDateStr.isEmpty() ) { | 233 | if ( !hasDateStr.isEmpty() ) { |
234 | 234 | ||
235 | todo->setDtStart( fromString( hasDateStr ) ); | 235 | todo->setDtStart( fromString( hasDateStr ) ); |
236 | todo->setHasStartDate( true); | 236 | todo->setHasStartDate( true); |
237 | } else | 237 | } else |
238 | todo->setHasStartDate( false ); | 238 | todo->setHasStartDate( false ); |
239 | hasDateStr = attList[4];//completed | 239 | hasDateStr = attList[4];//completed |
240 | if ( !hasDateStr.isEmpty() ) { | 240 | if ( !hasDateStr.isEmpty() ) { |
241 | todo->setCompleted(fromString( hasDateStr ) ); | 241 | todo->setCompleted(fromString( hasDateStr ) ); |
242 | } | 242 | } |
243 | QString completedStr = attList[5]; | 243 | QString completedStr = attList[5]; |
244 | if ( completedStr == "0" ) | 244 | if ( completedStr == "0" ) |
245 | todo->setCompleted( true ); | 245 | todo->setCompleted( true ); |
246 | else | 246 | else |
247 | todo->setCompleted( false ); | 247 | todo->setCompleted( false ); |
248 | mCalendar->addTodo( todo ); | 248 | mCalendar->addTodo( todo ); |
249 | 249 | ||
250 | } else if ( qName == "Category" ) { | 250 | } else if ( qName == "Category" ) { |
251 | /* | 251 | /* |
252 | QString id = attributes.value( "id" ); | 252 | QString id = attributes.value( "id" ); |
253 | QString name = attributes.value( "name" ); | 253 | QString name = attributes.value( "name" ); |
254 | setCategory( id, name ); | 254 | setCategory( id, name ); |
255 | */ | 255 | */ |
256 | } | 256 | } |
257 | //qDebug("end "); | 257 | //qDebug("end "); |
258 | return true; | 258 | return true; |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | void setCategoriesList ( QStringList * c ) | 262 | void setCategoriesList ( QStringList * c ) |
263 | { | 263 | { |
264 | oldCategories = c; | 264 | oldCategories = c; |
265 | } | 265 | } |
266 | 266 | ||
267 | QDateTime fromString ( QString s, bool useTz = true ) { | 267 | QDateTime fromString ( QString s, bool useTz = true ) { |
268 | QDateTime dt; | 268 | QDateTime dt; |
269 | int y,m,t,h,min,sec; | 269 | int y,m,t,h,min,sec; |
270 | y = s.mid(0,4).toInt(); | 270 | y = s.mid(0,4).toInt(); |
271 | m = s.mid(4,2).toInt(); | 271 | m = s.mid(4,2).toInt(); |
272 | t = s.mid(6,2).toInt(); | 272 | t = s.mid(6,2).toInt(); |
273 | h = s.mid(9,2).toInt(); | 273 | h = s.mid(9,2).toInt(); |
274 | min = s.mid(11,2).toInt(); | 274 | min = s.mid(11,2).toInt(); |
275 | sec = s.mid(13,2).toInt(); | 275 | sec = s.mid(13,2).toInt(); |
276 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); | 276 | dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); |
277 | int offset = KGlobal::locale()->localTimeOffset( dt ); | 277 | int offset = KGlobal::locale()->localTimeOffset( dt ); |
278 | if ( useTz ) | 278 | if ( useTz ) |
279 | dt = dt.addSecs ( offset*60); | 279 | dt = dt.addSecs ( offset*60); |
280 | return dt; | 280 | return dt; |
281 | 281 | ||
282 | } | 282 | } |
283 | protected: | 283 | protected: |
284 | QDateTime toDateTime( const QString &value ) | 284 | QDateTime toDateTime( const QString &value ) |
285 | { | 285 | { |
286 | QDateTime dt; | 286 | QDateTime dt; |
287 | dt.setTime_t( value.toUInt() ); | 287 | dt.setTime_t( value.toUInt() ); |
288 | 288 | ||
289 | return dt; | 289 | return dt; |
290 | } | 290 | } |
291 | 291 | ||
292 | QStringList lookupCategories( const QString &categoryList ) | 292 | QStringList lookupCategories( const QString &categoryList ) |
293 | { | 293 | { |
294 | QStringList categoryIds = QStringList::split( ";", categoryList ); | 294 | QStringList categoryIds = QStringList::split( ";", categoryList ); |
295 | QStringList categories; | 295 | QStringList categories; |
296 | QStringList::ConstIterator it; | 296 | QStringList::ConstIterator it; |
297 | for( it = categoryIds.begin(); it != categoryIds.end(); ++it ) { | 297 | for( it = categoryIds.begin(); it != categoryIds.end(); ++it ) { |
298 | QString cate = category( *it ); | 298 | QString cate = category( *it ); |
299 | if ( oldCategories ) { | 299 | if ( oldCategories ) { |
300 | if ( ! oldCategories->contains( cate ) ) | 300 | if ( ! oldCategories->contains( cate ) ) |
301 | oldCategories->append( cate ); | 301 | oldCategories->append( cate ); |
302 | } | 302 | } |
303 | categories.append(cate ); | 303 | categories.append(cate ); |
304 | } | 304 | } |
305 | return categories; | 305 | return categories; |
306 | } | 306 | } |
307 | 307 | ||
308 | private: | 308 | private: |
309 | Calendar *mCalendar; | 309 | Calendar *mCalendar; |
310 | QStringList * oldCategories; | 310 | QStringList * oldCategories; |
311 | static QString category( const QString &id ) | 311 | static QString category( const QString &id ) |
312 | { | 312 | { |
313 | QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id ); | 313 | QMap<QString,QString>::ConstIterator it = mCategoriesMap.find( id ); |
314 | if ( it == mCategoriesMap.end() ) return id; | 314 | if ( it == mCategoriesMap.end() ) return id; |
315 | else return *it; | 315 | else return *it; |
316 | } | 316 | } |
317 | 317 | ||
318 | static void setCategory( const QString &id, const QString &name ) | 318 | static void setCategory( const QString &id, const QString &name ) |
319 | { | 319 | { |
320 | mCategoriesMap.insert( id, name ); | 320 | mCategoriesMap.insert( id, name ); |
321 | } | 321 | } |
322 | 322 | ||
323 | static QMap<QString,QString> mCategoriesMap; | 323 | static QMap<QString,QString> mCategoriesMap; |
324 | }; | 324 | }; |
325 | 325 | ||
326 | QMap<QString,QString> SharpParser::mCategoriesMap; | 326 | QMap<QString,QString> PhoneParser::mCategoriesMap; |
327 | 327 | ||
328 | SharpFormat::SharpFormat() | 328 | PhoneFormat::PhoneFormat() |
329 | { | 329 | { |
330 | mCategories = 0; | 330 | mCategories = 0; |
331 | } | 331 | } |
332 | 332 | ||
333 | SharpFormat::~SharpFormat() | 333 | PhoneFormat::~PhoneFormat() |
334 | { | 334 | { |
335 | } | 335 | } |
336 | ulong SharpFormat::getCsum( const QStringList & attList) | 336 | ulong PhoneFormat::getCsum( const QStringList & attList) |
337 | { | 337 | { |
338 | int max = attList.count() -1; | 338 | int max = attList.count() -1; |
339 | ulong cSum = 0; | 339 | ulong cSum = 0; |
340 | int j,k,i; | 340 | int j,k,i; |
341 | int add; | 341 | int add; |
342 | for ( i = 1; i < max ; ++i ) { | 342 | for ( i = 1; i < max ; ++i ) { |
343 | QString s = attList[i]; | 343 | QString s = attList[i]; |
344 | if ( ! s.isEmpty() ){ | 344 | if ( ! s.isEmpty() ){ |
345 | j = s.length(); | 345 | j = s.length(); |
346 | for ( k = 0; k < j; ++k ) { | 346 | for ( k = 0; k < j; ++k ) { |
347 | int mul = k +1; | 347 | int mul = k +1; |
348 | add = s[k].unicode (); | 348 | add = s[k].unicode (); |
349 | if ( k < 16 ) | 349 | if ( k < 16 ) |
350 | mul = mul * mul; | 350 | mul = mul * mul; |
351 | add = add * mul *i*i*i; | 351 | add = add * mul *i*i*i; |
352 | cSum += add; | 352 | cSum += add; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | } | 355 | } |
356 | return cSum; | 356 | return cSum; |
357 | 357 | ||
358 | } | 358 | } |
359 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); | 359 | //extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); |
360 | #include <stdlib.h> | 360 | #include <stdlib.h> |
361 | #define DEBUGMODE false | 361 | #define DEBUGMODE false |
362 | bool SharpFormat::load( Calendar *calendar, Calendar *existngCal ) | 362 | bool PhoneFormat::load( Calendar *calendar, Calendar *existngCal ) |
363 | { | 363 | { |
364 | 364 | ||
365 | GSM_StateMachines; | 365 | GSM_StateMachines; |
366 | qDebug(" load "); | 366 | qDebug(" load "); |
367 | s.opened = false; | 367 | s.opened = false; |
368 | s.msg = NULL; | 368 | s.msg = NULL; |
369 | s.ConfigNum = 0; | 369 | s.ConfigNum = 0; |
370 | static char*cp; | 370 | static char*cp; |
371 | static INI_Section *cfg = NULL; | 371 | static INI_Section *cfg = NULL; |
372 | cfg=GSM_FindGammuRC(); | 372 | cfg=GSM_FindGammuRC(); |
373 | int i; | 373 | int i; |
374 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 374 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
375 | if (cfg!=NULL) { | 375 | if (cfg!=NULL) { |
376 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); | 376 | cp = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*)"gammucoding", false); |
377 | if (cp) di.coding = cp; | 377 | if (cp) di.coding = cp; |
378 | 378 | ||
379 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); | 379 | s.Config[i].Localize = (char *)INI_GetValue(cfg, (unsigned char*) "gammu", (unsigned char*) "gammuloc", false); |
380 | if (s.Config[i].Localize) { | 380 | if (s.Config[i].Localize) { |
381 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | 381 | s.msg=INI_ReadFile(s.Config[i].Localize, true); |
382 | } else { | 382 | } else { |
383 | #if !defined(WIN32) && defined(LOCALE_PATH) | 383 | #if !defined(WIN32) && defined(LOCALE_PATH) |
384 | locale = setlocale(LC_MESSAGES, NULL); | 384 | locale = setlocale(LC_MESSAGES, NULL); |
385 | if (locale != NULL) { | 385 | if (locale != NULL) { |
386 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | 386 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", |
387 | LOCALE_PATH, | 387 | LOCALE_PATH, |
388 | tolower(locale[0]), | 388 | tolower(locale[0]), |
389 | tolower(locale[1])); | 389 | tolower(locale[1])); |
390 | s.msg = INI_ReadFile(locale_file, true); | 390 | s.msg = INI_ReadFile(locale_file, true); |
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | } | 393 | } |
394 | } | 394 | } |
395 | 395 | ||
396 | /* Wanted user specific configuration? */ | 396 | /* Wanted user specific configuration? */ |
397 | 397 | ||
398 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 398 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
399 | 399 | ||
400 | s.ConfigNum++; | 400 | s.ConfigNum++; |
401 | 401 | ||
402 | /* We want to use only one file descriptor for global and state machine debug output */ | 402 | /* We want to use only one file descriptor for global and state machine debug output */ |
403 | s.Config[i].UseGlobalDebugFile = true; | 403 | s.Config[i].UseGlobalDebugFile = true; |
404 | 404 | ||
405 | 405 | ||
406 | 406 | ||
407 | /* We wanted to read just user specified configuration. */ | 407 | /* We wanted to read just user specified configuration. */ |
408 | {break;} | 408 | {break;} |
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | 413 | ||
414 | int error=GSM_InitConnection(&s,3); | 414 | int error=GSM_InitConnection(&s,3); |
415 | 415 | ||
416 | 416 | ||
417 | qDebug(" init %d %d", error, ERR_NONE); | 417 | qDebug(" init %d %d", error, ERR_NONE); |
418 | if ( error != ERR_NONE ) | 418 | if ( error != ERR_NONE ) |
419 | return false; | 419 | return false; |
420 | fromString2Cal( calendar, existngCal, &s, "Event" ); | 420 | fromString2Cal( calendar, existngCal, &s, "Event" ); |
421 | 421 | ||
422 | 422 | ||
423 | error=GSM_TerminateConnection(&s); | 423 | error=GSM_TerminateConnection(&s); |
424 | 424 | ||
425 | 425 | ||
426 | #if 0 | 426 | #if 0 |
427 | 427 | ||
428 | bool debug = DEBUGMODE; | 428 | bool debug = DEBUGMODE; |
429 | //debug = true; | 429 | //debug = true; |
430 | QString text; | 430 | QString text; |
431 | QString codec = "utf8"; | 431 | QString codec = "utf8"; |
432 | QLabel status ( i18n("Reading events ..."), 0 ); | 432 | QLabel status ( i18n("Reading events ..."), 0 ); |
433 | 433 | ||
434 | int w = status.sizeHint().width()+20 ; | 434 | int w = status.sizeHint().width()+20 ; |
435 | if ( w < 200 ) w = 200; | 435 | if ( w < 200 ) w = 200; |
436 | int h = status.sizeHint().height()+20 ; | 436 | int h = status.sizeHint().height()+20 ; |
437 | int dw = QApplication::desktop()->width(); | 437 | int dw = QApplication::desktop()->width(); |
438 | int dh = QApplication::desktop()->height(); | 438 | int dh = QApplication::desktop()->height(); |
439 | status.setCaption(i18n("Reading DTM Data") ); | 439 | status.setCaption(i18n("Reading DTM Data") ); |
440 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 440 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
441 | status.show(); | 441 | status.show(); |
442 | status.raise(); | 442 | status.raise(); |
443 | qApp->processEvents(); | 443 | qApp->processEvents(); |
444 | QString fileName; | 444 | QString fileName; |
445 | if ( ! debug ) { | 445 | if ( ! debug ) { |
446 | fileName = "/tmp/kopitempout"; | 446 | fileName = "/tmp/kopitempout"; |
447 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; | 447 | QString command ="db2file datebook -r -c "+ codec + " > " + fileName; |
448 | system ( command.latin1() ); | 448 | system ( command.latin1() ); |
449 | } else { | 449 | } else { |
450 | fileName = "/tmp/events.txt"; | 450 | fileName = "/tmp/events.txt"; |
451 | 451 | ||
452 | } | 452 | } |
453 | QFile file( fileName ); | 453 | QFile file( fileName ); |
454 | if (!file.open( IO_ReadOnly ) ) { | 454 | if (!file.open( IO_ReadOnly ) ) { |
455 | return false; | 455 | return false; |
456 | 456 | ||
457 | } | 457 | } |
458 | QTextStream ts( &file ); | 458 | QTextStream ts( &file ); |
459 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 459 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
460 | text = ts.read(); | 460 | text = ts.read(); |
461 | file.close(); | 461 | file.close(); |
462 | status.setText( i18n("Processing events ...") ); | 462 | status.setText( i18n("Processing events ...") ); |
463 | status.raise(); | 463 | status.raise(); |
464 | qApp->processEvents(); | 464 | qApp->processEvents(); |
465 | fromString2Cal( calendar, existngCal, text, "Event" ); | 465 | fromString2Cal( calendar, existngCal, text, "Event" ); |
466 | status.setText( i18n("Reading todos ...") ); | 466 | status.setText( i18n("Reading todos ...") ); |
467 | qApp->processEvents(); | 467 | qApp->processEvents(); |
468 | if ( ! debug ) { | 468 | if ( ! debug ) { |
469 | fileName = "/tmp/kopitempout"; | 469 | fileName = "/tmp/kopitempout"; |
470 | QString command = "db2file todo -r -c " + codec+ " > " + fileName; | 470 | QString command = "db2file todo -r -c " + codec+ " > " + fileName; |
471 | system ( command.latin1() ); | 471 | system ( command.latin1() ); |
472 | } else { | 472 | } else { |
473 | fileName = "/tmp/todo.txt"; | 473 | fileName = "/tmp/todo.txt"; |
474 | } | 474 | } |
475 | file.setName( fileName ); | 475 | file.setName( fileName ); |
476 | if (!file.open( IO_ReadOnly ) ) { | 476 | if (!file.open( IO_ReadOnly ) ) { |
477 | return false; | 477 | return false; |
478 | 478 | ||
479 | } | 479 | } |
480 | ts.setDevice( &file ); | 480 | ts.setDevice( &file ); |
481 | text = ts.read(); | 481 | text = ts.read(); |
482 | file.close(); | 482 | file.close(); |
483 | 483 | ||
484 | status.setText( i18n("Processing todos ...") ); | 484 | status.setText( i18n("Processing todos ...") ); |
485 | status.raise(); | 485 | status.raise(); |
486 | qApp->processEvents(); | 486 | qApp->processEvents(); |
487 | fromString2Cal( calendar, existngCal, text, "Todo" ); | 487 | fromString2Cal( calendar, existngCal, text, "Todo" ); |
488 | #endif | 488 | #endif |
489 | return true; | 489 | return true; |
490 | } | 490 | } |
491 | int SharpFormat::getNumFromRecord( QString answer, Incidence* inc ) | 491 | int PhoneFormat::getNumFromRecord( QString answer, Incidence* inc ) |
492 | { | 492 | { |
493 | int retval = -1; | 493 | int retval = -1; |
494 | QStringList templist; | 494 | QStringList templist; |
495 | QString tempString; | 495 | QString tempString; |
496 | int start = 0; | 496 | int start = 0; |
497 | int len = answer.length(); | 497 | int len = answer.length(); |
498 | int end = answer.find ("\n",start)+1; | 498 | int end = answer.find ("\n",start)+1; |
499 | bool ok = true; | 499 | bool ok = true; |
500 | start = end; | 500 | start = end; |
501 | int ccc = 0; | 501 | int ccc = 0; |
502 | while ( start > 0 ) { | 502 | while ( start > 0 ) { |
503 | templist.clear(); | 503 | templist.clear(); |
504 | ok = true; | 504 | ok = true; |
505 | int loopCount = 0; | 505 | int loopCount = 0; |
506 | while ( ok ) { | 506 | while ( ok ) { |
507 | ++loopCount; | 507 | ++loopCount; |
508 | if ( loopCount > 25 ) { | 508 | if ( loopCount > 25 ) { |
509 | qDebug("KO: Error in while loop"); | 509 | qDebug("KO: Error in while loop"); |
510 | ok = false; | 510 | ok = false; |
511 | start = 0; | 511 | start = 0; |
512 | break; | 512 | break; |
513 | } | 513 | } |
514 | if ( ok ) | 514 | if ( ok ) |
515 | tempString = getPart( answer, ok, start ); | 515 | tempString = getPart( answer, ok, start ); |
516 | if ( start >= len || start == 0 ) { | 516 | if ( start >= len || start == 0 ) { |
517 | start = 0; | 517 | start = 0; |
518 | ok = false; | 518 | ok = false; |
519 | } | 519 | } |
520 | if ( tempString.right(1) =="\n" ) | 520 | if ( tempString.right(1) =="\n" ) |
521 | tempString = tempString.left( tempString.length()-1); | 521 | tempString = tempString.left( tempString.length()-1); |
522 | 522 | ||
523 | templist.append( tempString ); | 523 | templist.append( tempString ); |
524 | } | 524 | } |
525 | ++ccc; | 525 | ++ccc; |
526 | if ( ccc == 2 && loopCount < 25 ) { | 526 | if ( ccc == 2 && loopCount < 25 ) { |
527 | start = 0; | 527 | start = 0; |
528 | bool ok; | 528 | bool ok; |
529 | int newnum = templist[0].toInt( &ok ); | 529 | int newnum = templist[0].toInt( &ok ); |
530 | if ( ok && newnum > 0) { | 530 | if ( ok && newnum > 0) { |
531 | retval = newnum; | 531 | retval = newnum; |
532 | inc->setZaurusId( newnum ); | 532 | //inc->setZaurusId( newnum ); |
533 | inc->setZaurusUid( getCsum( templist ) ); | 533 | //inc->setZaurusUid( getCsum( templist ) ); |
534 | inc->setZaurusStat( -4 ); | 534 | //inc->setZaurusStat( -4 ); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | } | 537 | } |
538 | //qDebug("getNumFromRecord returning : %d ", retval); | 538 | //qDebug("getNumFromRecord returning : %d ", retval); |
539 | return retval; | 539 | return retval; |
540 | } | 540 | } |
541 | bool SharpFormat::save( Calendar *calendar) | 541 | bool PhoneFormat::save( Calendar *calendar) |
542 | { | 542 | { |
543 | 543 | ||
544 | QLabel status ( i18n("Processing/adding events ..."), 0 ); | 544 | QLabel status ( i18n("Processing/adding events ..."), 0 ); |
545 | int w = status.sizeHint().width()+20 ; | 545 | int w = status.sizeHint().width()+20 ; |
546 | if ( w < 200 ) w = 200; | 546 | if ( w < 200 ) w = 200; |
547 | int h = status.sizeHint().height()+20 ; | 547 | int h = status.sizeHint().height()+20 ; |
548 | int dw = QApplication::desktop()->width(); | 548 | int dw = QApplication::desktop()->width(); |
549 | int dh = QApplication::desktop()->height(); | 549 | int dh = QApplication::desktop()->height(); |
550 | status.setCaption(i18n("Writing DTM Data") ); | 550 | status.setCaption(i18n("Writing DTM Data") ); |
551 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 551 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
552 | status.show(); | 552 | status.show(); |
553 | status.raise(); | 553 | status.raise(); |
554 | qApp->processEvents(); | 554 | qApp->processEvents(); |
555 | bool debug = DEBUGMODE; | 555 | bool debug = DEBUGMODE; |
556 | QString codec = "utf8"; | 556 | QString codec = "utf8"; |
557 | QString answer; | 557 | QString answer; |
558 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; | 558 | QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n"; |
559 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; | 559 | QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n"; |
560 | QString command; | 560 | QString command; |
561 | QPtrList<Event> er = calendar->rawEvents(); | 561 | QPtrList<Event> er = calendar->rawEvents(); |
562 | Event* ev = er.first(); | 562 | Event* ev = er.first(); |
563 | QString fileName = "/tmp/kopitempout"; | 563 | QString fileName = "/tmp/kopitempout"; |
564 | int i = 0; | 564 | int i = 0; |
565 | QString changeString = ePrefix; | 565 | QString changeString = ePrefix; |
566 | QString deleteString = ePrefix; | 566 | QString deleteString = ePrefix; |
567 | bool deleteEnt = false; | 567 | bool deleteEnt = false; |
568 | bool changeEnt = false; | 568 | bool changeEnt = false; |
569 | QString message = i18n("Processing event # "); | 569 | QString message = i18n("Processing event # "); |
570 | int procCount = 0; | 570 | int procCount = 0; |
571 | while ( ev ) { | 571 | while ( ev ) { |
572 | //qDebug("i %d ", ++i); | 572 | //qDebug("i %d ", ++i); |
573 | if ( ev->zaurusStat() != -2 ) { | 573 | if ( true /*ev->zaurusStat() != -2*/ ) { |
574 | status.setText ( message + QString::number ( ++procCount ) ); | 574 | status.setText ( message + QString::number ( ++procCount ) ); |
575 | qApp->processEvents(); | 575 | qApp->processEvents(); |
576 | QString eString = getEventString( ev ); | 576 | QString eString = getEventString( ev ); |
577 | if ( ev->zaurusStat() == -3 ) { // delete | 577 | if (/* ev->zaurusStat() == -3 */ true) { // delete |
578 | // deleting empty strings does not work. | 578 | // deleting empty strings does not work. |
579 | // we write first and x and then delete the record with the x | 579 | // we write first and x and then delete the record with the x |
580 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 580 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
581 | changeString += eString + "\n"; | 581 | changeString += eString + "\n"; |
582 | deleteString += eString + "\n"; | 582 | deleteString += eString + "\n"; |
583 | deleteEnt = true; | 583 | deleteEnt = true; |
584 | changeEnt = true; | 584 | changeEnt = true; |
585 | } | 585 | } |
586 | else if ( ev->zaurusId() == -1 ) { // add new | 586 | else if ( /*ev->zaurusId() == -1*/true ) { // add new |
587 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 587 | command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
588 | system ( command.utf8() ); | 588 | system ( command.utf8() ); |
589 | QFile file( fileName ); | 589 | QFile file( fileName ); |
590 | if (!file.open( IO_ReadOnly ) ) { | 590 | if (!file.open( IO_ReadOnly ) ) { |
591 | return false; | 591 | return false; |
592 | 592 | ||
593 | } | 593 | } |
594 | QTextStream ts( &file ); | 594 | QTextStream ts( &file ); |
595 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 595 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
596 | answer = ts.read(); | 596 | answer = ts.read(); |
597 | file.close(); | 597 | file.close(); |
598 | //qDebug("answer \n%s ", answer.latin1()); | 598 | //qDebug("answer \n%s ", answer.latin1()); |
599 | getNumFromRecord( answer, ev ) ; | 599 | getNumFromRecord( answer, ev ) ; |
600 | 600 | ||
601 | } | 601 | } |
602 | else { // change existing | 602 | else { // change existing |
603 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); | 603 | //qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() ); |
604 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 604 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
605 | changeString += eString + "\n"; | 605 | changeString += eString + "\n"; |
606 | changeEnt = true; | 606 | changeEnt = true; |
607 | 607 | ||
608 | } | 608 | } |
609 | } | 609 | } |
610 | ev = er.next(); | 610 | ev = er.next(); |
611 | } | 611 | } |
612 | status.setText ( i18n("Changing events ...") ); | 612 | status.setText ( i18n("Changing events ...") ); |
613 | qApp->processEvents(); | 613 | qApp->processEvents(); |
614 | //qDebug("changing... "); | 614 | //qDebug("changing... "); |
615 | if ( changeEnt ) { | 615 | if ( changeEnt ) { |
616 | QFile file( fileName ); | 616 | QFile file( fileName ); |
617 | if (!file.open( IO_WriteOnly ) ) { | 617 | if (!file.open( IO_WriteOnly ) ) { |
618 | return false; | 618 | return false; |
619 | 619 | ||
620 | } | 620 | } |
621 | QTextStream ts( &file ); | 621 | QTextStream ts( &file ); |
622 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 622 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
623 | ts << changeString ; | 623 | ts << changeString ; |
624 | file.close(); | 624 | file.close(); |
625 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; | 625 | command = "db2file datebook -w -g -c " + codec+ " < "+ fileName; |
626 | system ( command.latin1() ); | 626 | system ( command.latin1() ); |
627 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 627 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
628 | 628 | ||
629 | } | 629 | } |
630 | status.setText ( i18n("Deleting events ...") ); | 630 | status.setText ( i18n("Deleting events ...") ); |
631 | qApp->processEvents(); | 631 | qApp->processEvents(); |
632 | //qDebug("deleting... "); | 632 | //qDebug("deleting... "); |
633 | if ( deleteEnt ) { | 633 | if ( deleteEnt ) { |
634 | QFile file( fileName ); | 634 | QFile file( fileName ); |
635 | if (!file.open( IO_WriteOnly ) ) { | 635 | if (!file.open( IO_WriteOnly ) ) { |
636 | return false; | 636 | return false; |
637 | 637 | ||
638 | } | 638 | } |
639 | QTextStream ts( &file ); | 639 | QTextStream ts( &file ); |
640 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 640 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
641 | ts << deleteString; | 641 | ts << deleteString; |
642 | file.close(); | 642 | file.close(); |
643 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; | 643 | command = "db2file datebook -d -c " + codec+ " < "+ fileName; |
644 | system ( command.latin1() ); | 644 | system ( command.latin1() ); |
645 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 645 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
646 | } | 646 | } |
647 | 647 | ||
648 | 648 | ||
649 | changeString = tPrefix; | 649 | changeString = tPrefix; |
650 | deleteString = tPrefix; | 650 | deleteString = tPrefix; |
651 | status.setText ( i18n("Processing todos ...") ); | 651 | status.setText ( i18n("Processing todos ...") ); |
652 | qApp->processEvents(); | 652 | qApp->processEvents(); |
653 | QPtrList<Todo> tl = calendar->rawTodos(); | 653 | QPtrList<Todo> tl = calendar->rawTodos(); |
654 | Todo* to = tl.first(); | 654 | Todo* to = tl.first(); |
655 | i = 0; | 655 | i = 0; |
656 | message = i18n("Processing todo # "); | 656 | message = i18n("Processing todo # "); |
657 | procCount = 0; | 657 | procCount = 0; |
658 | while ( to ) { | 658 | while ( to ) { |
659 | if ( to->zaurusStat() != -2 ) { | 659 | if ( true /*to->zaurusStat() != -2 */) { |
660 | status.setText ( message + QString::number ( ++procCount ) ); | 660 | status.setText ( message + QString::number ( ++procCount ) ); |
661 | qApp->processEvents(); | 661 | qApp->processEvents(); |
662 | QString eString = getTodoString( to ); | 662 | QString eString = getTodoString( to ); |
663 | if ( to->zaurusStat() == -3 ) { // delete | 663 | if ( /*to->zaurusStat() == -3*/true ) { // delete |
664 | // deleting empty strings does not work. | 664 | // deleting empty strings does not work. |
665 | // we write first and x and then delete the record with the x | 665 | // we write first and x and then delete the record with the x |
666 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); | 666 | eString = eString.replace( QRegExp(",\"\""),",\"x\"" ); |
667 | changeString += eString + "\n"; | 667 | changeString += eString + "\n"; |
668 | deleteString += eString + "\n"; | 668 | deleteString += eString + "\n"; |
669 | deleteEnt = true; | 669 | deleteEnt = true; |
670 | changeEnt = true; | 670 | changeEnt = true; |
671 | } | 671 | } |
672 | else if ( to->zaurusId() == -1 ) { // add new | 672 | else if ( true /*to->zaurusId() == -1*/ ) { // add new |
673 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; | 673 | command = "(echo \"" + tPrefix + eString + "\" ) | db2file todo -w -g -c " + codec+ " > "+ fileName; |
674 | system ( command.utf8() ); | 674 | system ( command.utf8() ); |
675 | QFile file( fileName ); | 675 | QFile file( fileName ); |
676 | if (!file.open( IO_ReadOnly ) ) { | 676 | if (!file.open( IO_ReadOnly ) ) { |
677 | return false; | 677 | return false; |
678 | 678 | ||
679 | } | 679 | } |
680 | QTextStream ts( &file ); | 680 | QTextStream ts( &file ); |
681 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 681 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
682 | answer = ts.read(); | 682 | answer = ts.read(); |
683 | file.close(); | 683 | file.close(); |
684 | //qDebug("answer \n%s ", answer.latin1()); | 684 | //qDebug("answer \n%s ", answer.latin1()); |
685 | getNumFromRecord( answer, to ) ; | 685 | getNumFromRecord( answer, to ) ; |
686 | 686 | ||
687 | } | 687 | } |
688 | else { // change existing | 688 | else { // change existing |
689 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); | 689 | //qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() ); |
690 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; | 690 | //command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName; |
691 | changeString += eString + "\n"; | 691 | changeString += eString + "\n"; |
692 | changeEnt = true; | 692 | changeEnt = true; |
693 | 693 | ||
694 | } | 694 | } |
695 | } | 695 | } |
696 | 696 | ||
697 | to = tl.next(); | 697 | to = tl.next(); |
698 | } | 698 | } |
699 | status.setText ( i18n("Changing todos ...") ); | 699 | status.setText ( i18n("Changing todos ...") ); |
700 | qApp->processEvents(); | 700 | qApp->processEvents(); |
701 | //qDebug("changing... "); | 701 | //qDebug("changing... "); |
702 | if ( changeEnt ) { | 702 | if ( changeEnt ) { |
703 | QFile file( fileName ); | 703 | QFile file( fileName ); |
704 | if (!file.open( IO_WriteOnly ) ) { | 704 | if (!file.open( IO_WriteOnly ) ) { |
705 | return false; | 705 | return false; |
706 | 706 | ||
707 | } | 707 | } |
708 | QTextStream ts( &file ); | 708 | QTextStream ts( &file ); |
709 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 709 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
710 | ts << changeString ; | 710 | ts << changeString ; |
711 | file.close(); | 711 | file.close(); |
712 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; | 712 | command = "db2file todo -w -g -c " + codec+ " < "+ fileName; |
713 | system ( command.latin1() ); | 713 | system ( command.latin1() ); |
714 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); | 714 | //qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1()); |
715 | 715 | ||
716 | } | 716 | } |
717 | status.setText ( i18n("Deleting todos ...") ); | 717 | status.setText ( i18n("Deleting todos ...") ); |
718 | qApp->processEvents(); | 718 | qApp->processEvents(); |
719 | //qDebug("deleting... "); | 719 | //qDebug("deleting... "); |
720 | if ( deleteEnt ) { | 720 | if ( deleteEnt ) { |
721 | QFile file( fileName ); | 721 | QFile file( fileName ); |
722 | if (!file.open( IO_WriteOnly ) ) { | 722 | if (!file.open( IO_WriteOnly ) ) { |
723 | return false; | 723 | return false; |
724 | 724 | ||
725 | } | 725 | } |
726 | QTextStream ts( &file ); | 726 | QTextStream ts( &file ); |
727 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 727 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
728 | ts << deleteString; | 728 | ts << deleteString; |
729 | file.close(); | 729 | file.close(); |
730 | command = "db2file todo -d -c " + codec+ " < "+ fileName; | 730 | command = "db2file todo -d -c " + codec+ " < "+ fileName; |
731 | system ( command.latin1() ); | 731 | system ( command.latin1() ); |
732 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); | 732 | // qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1()); |
733 | } | 733 | } |
734 | 734 | ||
735 | return true; | 735 | return true; |
736 | } | 736 | } |
737 | QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ ) | 737 | QString PhoneFormat::dtToString( const QDateTime& dti, bool useTZ ) |
738 | { | 738 | { |
739 | QString datestr; | 739 | QString datestr; |
740 | QString timestr; | 740 | QString timestr; |
741 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 741 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
742 | QDateTime dt; | 742 | QDateTime dt; |
743 | if (useTZ) | 743 | if (useTZ) |
744 | dt = dti.addSecs ( -(offset*60)); | 744 | dt = dti.addSecs ( -(offset*60)); |
745 | else | 745 | else |
746 | dt = dti; | 746 | dt = dti; |
747 | if(dt.date().isValid()){ | 747 | if(dt.date().isValid()){ |
748 | const QDate& date = dt.date(); | 748 | const QDate& date = dt.date(); |
749 | datestr.sprintf("%04d%02d%02d", | 749 | datestr.sprintf("%04d%02d%02d", |
750 | date.year(), date.month(), date.day()); | 750 | date.year(), date.month(), date.day()); |
751 | } | 751 | } |
752 | if(dt.time().isValid()){ | 752 | if(dt.time().isValid()){ |
753 | const QTime& time = dt.time(); | 753 | const QTime& time = dt.time(); |
754 | timestr.sprintf("T%02d%02d%02d", | 754 | timestr.sprintf("T%02d%02d%02d", |
755 | time.hour(), time.minute(), time.second()); | 755 | time.hour(), time.minute(), time.second()); |
756 | } | 756 | } |
757 | return datestr + timestr; | 757 | return datestr + timestr; |
758 | } | 758 | } |
759 | QString SharpFormat::getEventString( Event* event ) | 759 | QString PhoneFormat::getEventString( Event* event ) |
760 | { | 760 | { |
761 | #if 0 | ||
761 | QStringList list; | 762 | QStringList list; |
762 | list.append( QString::number(event->zaurusId() ) ); | 763 | list.append( QString::number(event->zaurusId() ) ); |
763 | list.append( event->categories().join(",") ); | 764 | list.append( event->categories().join(",") ); |
764 | if ( !event->summary().isEmpty() ) | 765 | if ( !event->summary().isEmpty() ) |
765 | list.append( event->summary() ); | 766 | list.append( event->summary() ); |
766 | else | 767 | else |
767 | list.append("" ); | 768 | list.append("" ); |
768 | if ( !event->location().isEmpty() ) | 769 | if ( !event->location().isEmpty() ) |
769 | list.append( event->location() ); | 770 | list.append( event->location() ); |
770 | else | 771 | else |
771 | list.append("" ); | 772 | list.append("" ); |
772 | if ( !event->description().isEmpty() ) | 773 | if ( !event->description().isEmpty() ) |
773 | list.append( event->description() ); | 774 | list.append( event->description() ); |
774 | else | 775 | else |
775 | list.append( "" ); | 776 | list.append( "" ); |
776 | if ( event->doesFloat () ) { | 777 | if ( event->doesFloat () ) { |
777 | list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false )); | 778 | list.append( dtToString( QDateTime(event->dtStart().date(), QTime(0,0,0)), false )); |
778 | list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6 | 779 | list.append( dtToString( QDateTime(event->dtEnd().date(),QTime(23,59,59)), false )); //6 |
779 | list.append( "1" ); | 780 | list.append( "1" ); |
780 | 781 | ||
781 | } | 782 | } |
782 | else { | 783 | else { |
783 | list.append( dtToString( event->dtStart()) ); | 784 | list.append( dtToString( event->dtStart()) ); |
784 | list.append( dtToString( event->dtEnd()) ); //6 | 785 | list.append( dtToString( event->dtEnd()) ); //6 |
785 | list.append( "0" ); | 786 | list.append( "0" ); |
786 | } | 787 | } |
787 | bool noAlarm = true; | 788 | bool noAlarm = true; |
788 | if ( event->alarms().count() > 0 ) { | 789 | if ( event->alarms().count() > 0 ) { |
789 | Alarm * al = event->alarms().first(); | 790 | Alarm * al = event->alarms().first(); |
790 | if ( al->enabled() ) { | 791 | if ( al->enabled() ) { |
791 | noAlarm = false; | 792 | noAlarm = false; |
792 | list.append( "0" ); // yes, 0 == alarm | 793 | list.append( "0" ); // yes, 0 == alarm |
793 | list.append( QString::number( al->startOffset().asSeconds()/(-60) ) ); | 794 | list.append( QString::number( al->startOffset().asSeconds()/(-60) ) ); |
794 | if ( al->type() == Alarm::Audio ) | 795 | if ( al->type() == Alarm::Audio ) |
795 | list.append( "1" ); // type audio | 796 | list.append( "1" ); // type audio |
796 | else | 797 | else |
797 | list.append( "0" ); // type silent | 798 | list.append( "0" ); // type silent |
798 | } | 799 | } |
799 | } | 800 | } |
800 | if ( noAlarm ) { | 801 | if ( noAlarm ) { |
801 | list.append( "1" ); // yes, 1 == no alarm | 802 | list.append( "1" ); // yes, 1 == no alarm |
802 | list.append( "0" ); // no alarm offset | 803 | list.append( "0" ); // no alarm offset |
803 | list.append( "1" ); // type | 804 | list.append( "1" ); // type |
804 | } | 805 | } |
805 | // next is: 11 | 806 | // next is: 11 |
806 | // next is: 11-16 are recurrence | 807 | // next is: 11-16 are recurrence |
807 | Recurrence* rec = event->recurrence(); | 808 | Recurrence* rec = event->recurrence(); |
808 | 809 | ||
809 | bool writeEndDate = false; | 810 | bool writeEndDate = false; |
810 | switch ( rec->doesRecur() ) | 811 | switch ( rec->doesRecur() ) |
811 | { | 812 | { |
812 | case Recurrence::rDaily: // 0 | 813 | case Recurrence::rDaily: // 0 |
813 | list.append( "0" ); | 814 | list.append( "0" ); |
814 | list.append( QString::number( rec->frequency() ));//12 | 815 | list.append( QString::number( rec->frequency() ));//12 |
815 | list.append( "0" ); | 816 | list.append( "0" ); |
816 | list.append( "0" ); | 817 | list.append( "0" ); |
817 | writeEndDate = true; | 818 | writeEndDate = true; |
818 | break; | 819 | break; |
819 | case Recurrence::rWeekly:// 1 | 820 | case Recurrence::rWeekly:// 1 |
820 | list.append( "1" ); | 821 | list.append( "1" ); |
821 | list.append( QString::number( rec->frequency()) );//12 | 822 | list.append( QString::number( rec->frequency()) );//12 |
822 | list.append( "0" ); | 823 | list.append( "0" ); |
823 | { | 824 | { |
824 | int days = 0; | 825 | int days = 0; |
825 | QBitArray weekDays = rec->days(); | 826 | QBitArray weekDays = rec->days(); |
826 | int i; | 827 | int i; |
827 | for( i = 1; i <= 7; ++i ) { | 828 | for( i = 1; i <= 7; ++i ) { |
828 | if ( weekDays[i-1] ) { | 829 | if ( weekDays[i-1] ) { |
829 | days += 1 << (i-1); | 830 | days += 1 << (i-1); |
830 | } | 831 | } |
831 | } | 832 | } |
832 | list.append( QString::number( days ) ); | 833 | list.append( QString::number( days ) ); |
833 | } | 834 | } |
834 | //pending weekdays | 835 | //pending weekdays |
835 | writeEndDate = true; | 836 | writeEndDate = true; |
836 | 837 | ||
837 | break; | 838 | break; |
838 | case Recurrence::rMonthlyPos:// 2 | 839 | case Recurrence::rMonthlyPos:// 2 |
839 | list.append( "2" ); | 840 | list.append( "2" ); |
840 | list.append( QString::number( rec->frequency()) );//12 | 841 | list.append( QString::number( rec->frequency()) );//12 |
841 | 842 | ||
842 | writeEndDate = true; | 843 | writeEndDate = true; |
843 | { | 844 | { |
844 | int count = 1; | 845 | int count = 1; |
845 | QPtrList<Recurrence::rMonthPos> rmp; | 846 | QPtrList<Recurrence::rMonthPos> rmp; |
846 | rmp = rec->monthPositions(); | 847 | rmp = rec->monthPositions(); |
847 | if ( rmp.first()->negative ) | 848 | if ( rmp.first()->negative ) |
848 | count = 5 - rmp.first()->rPos - 1; | 849 | count = 5 - rmp.first()->rPos - 1; |
849 | else | 850 | else |
850 | count = rmp.first()->rPos - 1; | 851 | count = rmp.first()->rPos - 1; |
851 | list.append( QString::number( count ) ); | 852 | list.append( QString::number( count ) ); |
852 | 853 | ||
853 | } | 854 | } |
854 | 855 | ||
855 | list.append( "0" ); | 856 | list.append( "0" ); |
856 | break; | 857 | break; |
857 | case Recurrence::rMonthlyDay:// 3 | 858 | case Recurrence::rMonthlyDay:// 3 |
858 | list.append( "3" ); | 859 | list.append( "3" ); |
859 | list.append( QString::number( rec->frequency()) );//12 | 860 | list.append( QString::number( rec->frequency()) );//12 |
860 | list.append( "0" ); | 861 | list.append( "0" ); |
861 | list.append( "0" ); | 862 | list.append( "0" ); |
862 | writeEndDate = true; | 863 | writeEndDate = true; |
863 | break; | 864 | break; |
864 | case Recurrence::rYearlyMonth://4 | 865 | case Recurrence::rYearlyMonth://4 |
865 | list.append( "4" ); | 866 | list.append( "4" ); |
866 | list.append( QString::number( rec->frequency()) );//12 | 867 | list.append( QString::number( rec->frequency()) );//12 |
867 | list.append( "0" ); | 868 | list.append( "0" ); |
868 | list.append( "0" ); | 869 | list.append( "0" ); |
869 | writeEndDate = true; | 870 | writeEndDate = true; |
870 | break; | 871 | break; |
871 | 872 | ||
872 | default: | 873 | default: |
873 | list.append( "255" ); | 874 | list.append( "255" ); |
874 | list.append( QString() ); | 875 | list.append( QString() ); |
875 | list.append( "0" ); | 876 | list.append( "0" ); |
876 | list.append( QString() ); | 877 | list.append( QString() ); |
877 | list.append( "0" ); | 878 | list.append( "0" ); |
878 | list.append( "20991231T000000" ); | 879 | list.append( "20991231T000000" ); |
879 | break; | 880 | break; |
880 | } | 881 | } |
881 | if ( writeEndDate ) { | 882 | if ( writeEndDate ) { |
882 | 883 | ||
883 | if ( rec->endDate().isValid() ) { // 15 + 16 | 884 | if ( rec->endDate().isValid() ) { // 15 + 16 |
884 | list.append( "1" ); | 885 | list.append( "1" ); |
885 | list.append( dtToString( rec->endDate()) ); | 886 | list.append( dtToString( rec->endDate()) ); |
886 | } else { | 887 | } else { |
887 | list.append( "0" ); | 888 | list.append( "0" ); |
888 | list.append( "20991231T000000" ); | 889 | list.append( "20991231T000000" ); |
889 | } | 890 | } |
890 | 891 | ||
891 | } | 892 | } |
892 | if ( event->doesFloat () ) { | 893 | if ( event->doesFloat () ) { |
893 | list.append( dtToString( event->dtStart(), false ).left( 8 )); | 894 | list.append( dtToString( event->dtStart(), false ).left( 8 )); |
894 | list.append( dtToString( event->dtEnd(), false ).left( 8 )); //6 | 895 | list.append( dtToString( event->dtEnd(), false ).left( 8 )); //6 |
895 | 896 | ||
896 | } | 897 | } |
897 | else { | 898 | else { |
898 | list.append( QString() ); | 899 | list.append( QString() ); |
899 | list.append( QString() ); | 900 | list.append( QString() ); |
900 | 901 | ||
901 | } | 902 | } |
902 | if (event->dtStart().date() == event->dtEnd().date() ) | 903 | if (event->dtStart().date() == event->dtEnd().date() ) |
903 | list.append( "0" ); | 904 | list.append( "0" ); |
904 | else | 905 | else |
905 | list.append( "1" ); | 906 | list.append( "1" ); |
906 | 907 | ||
907 | 908 | ||
908 | for(QStringList::Iterator it=list.begin(); | 909 | for(QStringList::Iterator it=list.begin(); |
909 | it!=list.end(); ++it){ | 910 | it!=list.end(); ++it){ |
910 | QString& s = (*it); | 911 | QString& s = (*it); |
911 | s.replace(QRegExp("\""), "\"\""); | 912 | s.replace(QRegExp("\""), "\"\""); |
912 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | 913 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ |
913 | s.prepend('\"'); | 914 | s.prepend('\"'); |
914 | s.append('\"'); | 915 | s.append('\"'); |
915 | } else if(s.isEmpty() && !s.isNull()){ | 916 | } else if(s.isEmpty() && !s.isNull()){ |
916 | s = "\"\""; | 917 | s = "\"\""; |
917 | } | 918 | } |
918 | } | 919 | } |
919 | return list.join(","); | 920 | return list.join(","); |
920 | 921 | #endif | |
922 | return QString(); | ||
921 | 923 | ||
922 | } | 924 | } |
923 | QString SharpFormat::getTodoString( Todo* todo ) | 925 | QString PhoneFormat::getTodoString( Todo* todo ) |
924 | { | 926 | { |
927 | #if 0 | ||
925 | QStringList list; | 928 | QStringList list; |
926 | list.append( QString::number( todo->zaurusId() ) ); | 929 | list.append( QString::number( todo->zaurusId() ) ); |
927 | list.append( todo->categories().join(",") ); | 930 | list.append( todo->categories().join(",") ); |
928 | 931 | ||
929 | if ( todo->hasStartDate() ) { | 932 | if ( todo->hasStartDate() ) { |
930 | list.append( dtToString( todo->dtStart()) ); | 933 | list.append( dtToString( todo->dtStart()) ); |
931 | } else | 934 | } else |
932 | list.append( QString() ); | 935 | list.append( QString() ); |
933 | 936 | ||
934 | if ( todo->hasDueDate() ) { | 937 | if ( todo->hasDueDate() ) { |
935 | QTime tim; | 938 | QTime tim; |
936 | if ( todo->doesFloat()) { | 939 | if ( todo->doesFloat()) { |
937 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; | 940 | list.append( dtToString( QDateTime(todo->dtDue().date(),QTime( 0,0,0 )), false)) ; |
938 | } else { | 941 | } else { |
939 | list.append( dtToString(todo->dtDue() ) ); | 942 | list.append( dtToString(todo->dtDue() ) ); |
940 | } | 943 | } |
941 | } else | 944 | } else |
942 | list.append( QString() ); | 945 | list.append( QString() ); |
943 | 946 | ||
944 | if ( todo->isCompleted() ) { | 947 | if ( todo->isCompleted() ) { |
945 | list.append( dtToString( todo->completed()) ); | 948 | list.append( dtToString( todo->completed()) ); |
946 | list.append( "0" ); // yes 0 == completed | 949 | list.append( "0" ); // yes 0 == completed |
947 | } else { | 950 | } else { |
948 | list.append( dtToString( todo->completed()) ); | 951 | list.append( dtToString( todo->completed()) ); |
949 | list.append( "1" ); | 952 | list.append( "1" ); |
950 | } | 953 | } |
951 | list.append( QString::number( todo->priority() )); | 954 | list.append( QString::number( todo->priority() )); |
952 | if( ! todo->summary().isEmpty() ) | 955 | if( ! todo->summary().isEmpty() ) |
953 | list.append( todo->summary() ); | 956 | list.append( todo->summary() ); |
954 | else | 957 | else |
955 | list.append( "" ); | 958 | list.append( "" ); |
956 | if (! todo->description().isEmpty() ) | 959 | if (! todo->description().isEmpty() ) |
957 | list.append( todo->description() ); | 960 | list.append( todo->description() ); |
958 | else | 961 | else |
959 | list.append( "" ); | 962 | list.append( "" ); |
960 | for(QStringList::Iterator it=list.begin(); | 963 | for(QStringList::Iterator it=list.begin(); |
961 | it!=list.end(); ++it){ | 964 | it!=list.end(); ++it){ |
962 | QString& s = (*it); | 965 | QString& s = (*it); |
963 | s.replace(QRegExp("\""), "\"\""); | 966 | s.replace(QRegExp("\""), "\"\""); |
964 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ | 967 | if(s.contains(QRegExp("[,\"\r\n]")) || s.stripWhiteSpace() != s){ |
965 | s.prepend('\"'); | 968 | s.prepend('\"'); |
966 | s.append('\"'); | 969 | s.append('\"'); |
967 | } else if(s.isEmpty() && !s.isNull()){ | 970 | } else if(s.isEmpty() && !s.isNull()){ |
968 | s = "\"\""; | 971 | s = "\"\""; |
969 | } | 972 | } |
970 | } | 973 | } |
971 | return list.join(","); | 974 | return list.join(","); |
975 | #endif | ||
976 | return QString(); | ||
972 | } | 977 | } |
973 | QString SharpFormat::getPart( const QString & text, bool &ok, int &start ) | 978 | QString PhoneFormat::getPart( const QString & text, bool &ok, int &start ) |
974 | { | 979 | { |
975 | //qDebug("start %d ", start); | 980 | //qDebug("start %d ", start); |
976 | 981 | ||
977 | QString retval =""; | 982 | QString retval =""; |
978 | if ( text.at(start) == '"' ) { | 983 | if ( text.at(start) == '"' ) { |
979 | if ( text.mid( start,2) == "\"\"" && !( text.mid( start+2,1) == "\"")) { | 984 | if ( text.mid( start,2) == "\"\"" && !( text.mid( start+2,1) == "\"")) { |
980 | start = start +2; | 985 | start = start +2; |
981 | if ( text.mid( start,1) == "," ) { | 986 | if ( text.mid( start,1) == "," ) { |
982 | start += 1; | 987 | start += 1; |
983 | } | 988 | } |
984 | retval = ""; | 989 | retval = ""; |
985 | if ( text.mid( start,1) == "\n" ) { | 990 | if ( text.mid( start,1) == "\n" ) { |
986 | start += 1; | 991 | start += 1; |
987 | ok = false; | 992 | ok = false; |
988 | } | 993 | } |
989 | return retval; | 994 | return retval; |
990 | } | 995 | } |
991 | int hk = start+1; | 996 | int hk = start+1; |
992 | hk = text.find ('"',hk); | 997 | hk = text.find ('"',hk); |
993 | while ( text.at(hk+1) == '"' ) | 998 | while ( text.at(hk+1) == '"' ) |
994 | hk = text.find ('"',hk+2); | 999 | hk = text.find ('"',hk+2); |
995 | retval = text.mid( start+1, hk-start-1); | 1000 | retval = text.mid( start+1, hk-start-1); |
996 | start = hk+1; | 1001 | start = hk+1; |
997 | retval.replace( QRegExp("\"\""), "\""); | 1002 | retval.replace( QRegExp("\"\""), "\""); |
998 | if ( text.mid( start,1) == "," ) { | 1003 | if ( text.mid( start,1) == "," ) { |
999 | start += 1; | 1004 | start += 1; |
1000 | } | 1005 | } |
1001 | if ( text.mid( start,1) == "\n" ) { | 1006 | if ( text.mid( start,1) == "\n" ) { |
1002 | start += 1; | 1007 | start += 1; |
1003 | ok = false; | 1008 | ok = false; |
1004 | } | 1009 | } |
1005 | //qDebug("retval***%s*** ",retval.latin1() ); | 1010 | //qDebug("retval***%s*** ",retval.latin1() ); |
1006 | return retval; | 1011 | return retval; |
1007 | 1012 | ||
1008 | } else { | 1013 | } else { |
1009 | int nl = text.find ("\n",start); | 1014 | int nl = text.find ("\n",start); |
1010 | int kom = text.find (',',start); | 1015 | int kom = text.find (',',start); |
1011 | if ( kom < nl ) { | 1016 | if ( kom < nl ) { |
1012 | // qDebug("kom < nl %d ", kom); | 1017 | // qDebug("kom < nl %d ", kom); |
1013 | retval = text.mid(start, kom-start); | 1018 | retval = text.mid(start, kom-start); |
1014 | start = kom+1; | 1019 | start = kom+1; |
1015 | return retval; | 1020 | return retval; |
1016 | } else { | 1021 | } else { |
1017 | if ( nl == kom ) { | 1022 | if ( nl == kom ) { |
1018 | // qDebug(" nl == kom "); | 1023 | // qDebug(" nl == kom "); |
1019 | start = 0; | 1024 | start = 0; |
1020 | ok = false; | 1025 | ok = false; |
1021 | return "0"; | 1026 | return "0"; |
1022 | } | 1027 | } |
1023 | // qDebug(" nl < kom ", nl); | 1028 | // qDebug(" nl < kom ", nl); |
1024 | retval = text.mid( start, nl-start); | 1029 | retval = text.mid( start, nl-start); |
1025 | ok = false; | 1030 | ok = false; |
1026 | start = nl+1; | 1031 | start = nl+1; |
1027 | return retval; | 1032 | return retval; |
1028 | } | 1033 | } |
1029 | } | 1034 | } |
1030 | } | 1035 | } |
1031 | bool SharpFormat::fromString( Calendar *calendar, const QString & text) | 1036 | bool PhoneFormat::fromString( Calendar *calendar, const QString & text) |
1032 | { | 1037 | { |
1033 | return false; | 1038 | return false; |
1034 | } | 1039 | } |
1035 | bool SharpFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, GSM_StateMachine*s, const QString & type) | 1040 | bool PhoneFormat::fromString2Cal( Calendar *calendar,Calendar *existingCalendar, GSM_StateMachine*s, const QString & type) |
1036 | { | 1041 | { |
1037 | GSM_Phone_Functions*Phone; | 1042 | GSM_Phone_Functions*Phone; |
1038 | 1043 | ||
1039 | GSM_CalendarEntrynote; | 1044 | GSM_CalendarEntrynote; |
1040 | GSM_CalendarEntry*Note; | 1045 | GSM_CalendarEntry*Note; |
1041 | bool refresh= true; | 1046 | bool refresh= true; |
1042 | 1047 | ||
1043 | Phone=s->Phone.Functions; | 1048 | Phone=s->Phone.Functions; |
1044 | bool gshutdown = false; | 1049 | bool gshutdown = false; |
1045 | SharpParser handler( calendar ); | 1050 | PhoneParser handler( calendar ); |
1046 | //handler.setCategoriesList( mCategories ); | 1051 | //handler.setCategoriesList( mCategories ); |
1047 | QStringList templist; | 1052 | QStringList templist; |
1048 | QString tempString; | 1053 | QString tempString; |
1049 | int start = 0; | 1054 | int start = 0; |
1050 | int error; | 1055 | int error; |
1051 | int ccc = 0; | 1056 | int ccc = 0; |
1052 | while (!gshutdown && ccc++ < 10 ) { | 1057 | while (!gshutdown && ccc++ < 10 ) { |
1053 | QString CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY; | 1058 | QString CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY; |
1054 | templist.clear(); | 1059 | templist.clear(); |
1055 | qDebug("count %d ", ccc); | 1060 | qDebug("count %d ", ccc); |
1056 | error=Phone->GetNextCalendar(s,¬e,refresh); | 1061 | error=Phone->GetNextCalendar(s,¬e,refresh); |
1057 | if (error == ERR_EMPTY) break; | 1062 | if (error == ERR_EMPTY) break; |
1058 | 1063 | ||
1059 | Note = ¬e; | 1064 | Note = ¬e; |
1060 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY | 1065 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY |
1061 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1066 | // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
1062 | 1067 | ||
1063 | //ARSD silentalarm = 0 | 1068 | //ARSD silentalarm = 0 |
1064 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly | 1069 | // 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly |
1065 | // 12 RFRQ | 1070 | // 12 RFRQ |
1066 | // 13 RPOS pos = 4. monday in month | 1071 | // 13 RPOS pos = 4. monday in month |
1067 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun | 1072 | // 14 RDYS days: 1 mon/ 2 tue .. 64 sun |
1068 | // 15 REND 0 = no end/ 1 = end | 1073 | // 15 REND 0 = no end/ 1 = end |
1069 | // 16 REDT rec end dt | 1074 | // 16 REDT rec end dt |
1070 | //ALSD | 1075 | //ALSD |
1071 | //ALED | 1076 | //ALED |
1072 | //MDAY | 1077 | //MDAY |
1073 | 1078 | ||
1074 | CARDID = QString::number( Note->Location ); // 0 | 1079 | CARDID = QString::number( Note->Location ); // 0 |
1075 | 1080 | ||
1076 | 1081 | ||
1077 | int i_age = 0,i; | 1082 | int i_age = 0,i; |
1078 | GSM_DateTime Alarm,DateTime; | 1083 | GSM_DateTime Alarm,DateTime; |
1079 | GSM_DateTime* dtp; | 1084 | GSM_DateTime* dtp; |
1080 | GSM_MemoryEntry entry; | 1085 | GSM_MemoryEntry entry; |
1081 | unsigned char *name; | 1086 | unsigned char *name; |
1082 | 1087 | ||
1083 | bool repeating = false; | 1088 | bool repeating = false; |
1084 | int repeat_dayofweek = -1; | 1089 | int repeat_dayofweek = -1; |
1085 | int repeat_day = -1; | 1090 | int repeat_day = -1; |
1086 | int repeat_weekofmonth = -1; | 1091 | int repeat_weekofmonth = -1; |
1087 | int repeat_month = -1; | 1092 | int repeat_month = -1; |
1088 | int repeat_frequency = -1; | 1093 | int repeat_frequency = -1; |
1089 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | 1094 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; |
1090 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | 1095 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; |
1091 | 1096 | ||
1092 | Alarm.Year = 0; | 1097 | Alarm.Year = 0; |
1093 | 1098 | ||
1094 | repeating = false; | 1099 | repeating = false; |
1095 | repeat_dayofweek = -1; | 1100 | repeat_dayofweek = -1; |
1096 | repeat_day = -1; | 1101 | repeat_day = -1; |
1097 | repeat_weekofmonth = -1; | 1102 | repeat_weekofmonth = -1; |
1098 | repeat_month = -1; | 1103 | repeat_month = -1; |
1099 | repeat_frequency = -1; | 1104 | repeat_frequency = -1; |
1100 | repeat_startdate.Day= 0; | 1105 | repeat_startdate.Day= 0; |
1101 | repeat_stopdate.Day = 0; | 1106 | repeat_stopdate.Day = 0; |
1102 | 1107 | ||
1103 | 1108 | ||
1104 | switch (Note->Type) { | 1109 | switch (Note->Type) { |
1105 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; | 1110 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; |
1106 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; | 1111 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; |
1107 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; | 1112 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; |
1108 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; | 1113 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; |
1109 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; | 1114 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; |
1110 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; | 1115 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; |
1111 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; | 1116 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; |
1112 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; | 1117 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; |
1113 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; | 1118 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; |
1114 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; | 1119 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; |
1115 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; | 1120 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; |
1116 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; | 1121 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; |
1117 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; | 1122 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; |
1118 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; | 1123 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; |
1119 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; | 1124 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; |
1120 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; | 1125 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; |
1121 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; | 1126 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; |
1122 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; | 1127 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; |
1123 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; | 1128 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; |
1124 | case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; | 1129 | case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; |
1125 | case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; | 1130 | case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; |
1126 | case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; | 1131 | case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; |
1127 | case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; | 1132 | case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; |
1128 | case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; | 1133 | case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; |
1129 | case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; | 1134 | case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; |
1130 | case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; | 1135 | case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; |
1131 | case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; | 1136 | case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; |
1132 | case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; | 1137 | case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; |
1133 | default : CATEGORY = QString(""); | 1138 | default : CATEGORY = QString(""); |
1134 | } | 1139 | } |
1135 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY | 1140 | //CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY |
1136 | // 0x 1x 2x 3x 4x 5x 6x 7x 8x 9x 10? 11 12 13 14 15 16 17x 18x 19? | 1141 | // 0x 1x 2x 3x 4x 5x 6x 7x 8x 9x 10? 11 12 13 14 15 16 17x 18x 19? |
1137 | 1142 | ||
1138 | MEM1 = ""; | 1143 | MEM1 = ""; |
1139 | 1144 | ||
1140 | #if 0 | 1145 | #if 0 |
1141 | 1146 | ||
1142 | if ( attList[7] == "1" ) { | 1147 | if ( attList[7] == "1" ) { |
1143 | event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) )); | 1148 | event->setDtStart( QDateTime(fromString( attList[17]+"000000", false ).date(),QTime(0,0,0 ) )); |
1144 | event->setDtEnd( QDateTime(fromString( attList[18]+"000000", false ).date(),QTime(0,0,0 ))); | 1149 | event->setDtEnd( QDateTime(fromString( attList[18]+"000000", false ).date(),QTime(0,0,0 ))); |
1145 | event->setFloats( true ); | 1150 | event->setFloats( true ); |
1146 | } else { | 1151 | } else { |
1147 | event->setFloats( false ); | 1152 | event->setFloats( false ); |
1148 | event->setDtStart( fromString( attList[5] ) ); | 1153 | event->setDtStart( fromString( attList[5] ) ); |
1149 | event->setDtEnd( fromString( attList[6] )); | 1154 | event->setDtEnd( fromString( attList[6] )); |
1150 | } | 1155 | } |
1151 | 1156 | ||
1152 | 1157 | ||
1153 | 1158 | ||
1154 | typedef struct { | 1159 | typedef struct { |
1155 | /** | 1160 | /** |
1156 | * The difference between local time and GMT in hours | 1161 | * The difference between local time and GMT in hours |
1157 | */ | 1162 | */ |
1158 | int Timezone; | 1163 | int Timezone; |
1159 | 1164 | ||
1160 | unsigned int Second; | 1165 | unsigned int Second; |
1161 | unsigned int Minute; | 1166 | unsigned int Minute; |
1162 | unsigned int Hour; | 1167 | unsigned int Hour; |
1163 | 1168 | ||
1164 | unsigned int Day; | 1169 | unsigned int Day; |
1165 | /** | 1170 | /** |
1166 | * January = 1, February = 2, etc. | 1171 | * January = 1, February = 2, etc. |
1167 | */ | 1172 | */ |
1168 | unsigned int Month; | 1173 | unsigned int Month; |
1169 | /** | 1174 | /** |
1170 | * Complete year number. Not 03, but 2003 | 1175 | * Complete year number. Not 03, but 2003 |
1171 | */ | 1176 | */ |
1172 | unsigned int Year; | 1177 | unsigned int Year; |
1173 | } GSM_DateTime; | 1178 | } GSM_DateTime; |
1174 | 1179 | ||
1175 | if(dt.date().isValid()){ | 1180 | if(dt.date().isValid()){ |
1176 | const QDate& date = dt.date(); | 1181 | const QDate& date = dt.date(); |
1177 | datestr.sprintf("%04d%02d%02d", | 1182 | datestr.sprintf("%04d%02d%02d", |
1178 | date.year(), date.month(), date.day()); | 1183 | date.year(), date.month(), date.day()); |
1179 | } | 1184 | } |
1180 | if(dt.time().isValid()){ | 1185 | if(dt.time().isValid()){ |
1181 | const QTime& time = dt.time(); | 1186 | const QTime& time = dt.time(); |
1182 | timestr.sprintf("T%02d%02d%02d", | 1187 | timestr.sprintf("T%02d%02d%02d", |
1183 | time.hour(), time.minute(), time.second()); | 1188 | time.hour(), time.minute(), time.second()); |
1184 | } | 1189 | } |
1185 | return datestr + timestr; | 1190 | return datestr + timestr; |
1186 | 1191 | ||
1187 | 1192 | ||
1188 | 1193 | ||
1189 | 1194 | ||
1190 | #endif | 1195 | #endif |
1191 | 1196 | ||
1192 | 1197 | ||
1193 | ADAY = "0"; | 1198 | ADAY = "0"; |
1194 | ARON = "1"; // 1 == disabled | 1199 | ARON = "1"; // 1 == disabled |
1195 | ARMN = "0"; //alarm offset in minutes | 1200 | ARMN = "0"; //alarm offset in minutes |
1196 | 1201 | ||
1197 | for (i=0;i<Note->EntriesNum;i++) { | 1202 | for (i=0;i<Note->EntriesNum;i++) { |
1198 | 1203 | ||
1199 | qDebug(" for "); | 1204 | qDebug(" for "); |
1200 | switch (Note->Entries[i].EntryType) { | 1205 | switch (Note->Entries[i].EntryType) { |
1201 | case CAL_START_DATETIME: | 1206 | case CAL_START_DATETIME: |
1202 | dtp = &Note->Entries[i].Date ; | 1207 | dtp = &Note->Entries[i].Date ; |
1203 | 1208 | ||
1204 | qDebug("hour: %d ", dtp->Hour); | 1209 | qDebug("hour: %d ", dtp->Hour); |
1205 | if ( dtp->Hour == -1 ) { | 1210 | if ( dtp->Hour == -1 ) { |
1206 | ADAY = "1"; | 1211 | ADAY = "1"; |
1207 | ALSD.sprintf("%04d%02d%02d",dtp->Year, dtp->Month, dtp->Day ); | 1212 | ALSD.sprintf("%04d%02d%02d",dtp->Year, dtp->Month, dtp->Day ); |
1208 | TIM1.sprintf("%04d%02d%02dT000000",dtp->Year, dtp->Month, dtp->Day ); | 1213 | TIM1.sprintf("%04d%02d%02dT000000",dtp->Year, dtp->Month, dtp->Day ); |
1209 | } else { | 1214 | } else { |
1210 | TIM1.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); | 1215 | TIM1.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); |
1211 | 1216 | ||
1212 | } | 1217 | } |
1213 | ////printmsg("Start : %s\n",OSDateTime(Note->Entries[i].Date,false)); | 1218 | ////printmsg("Start : %s\n",OSDateTime(Note->Entries[i].Date,false)); |
1214 | //memcpy(&DateTime,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | 1219 | //memcpy(&DateTime,&Note->Entries[i].Date,sizeof(GSM_DateTime)); |
1215 | break; | 1220 | break; |
1216 | case CAL_END_DATETIME: | 1221 | case CAL_END_DATETIME: |
1217 | dtp = &Note->Entries[i].Date ; | 1222 | dtp = &Note->Entries[i].Date ; |
1218 | qDebug("hour2: %d ", dtp->Hour); | 1223 | qDebug("hour2: %d ", dtp->Hour); |
1219 | if ( dtp->Hour == -1 ) { | 1224 | if ( dtp->Hour == -1 ) { |
1220 | ADAY = "1"; | 1225 | ADAY = "1"; |
1221 | ALED.sprintf("%04d%02d%02d",dtp->Year, dtp->Month, dtp->Day ); | 1226 | ALED.sprintf("%04d%02d%02d",dtp->Year, dtp->Month, dtp->Day ); |
1222 | TIM2.sprintf("%04d%02d%02dT000000",dtp->Year, dtp->Month, dtp->Day ); | 1227 | TIM2.sprintf("%04d%02d%02dT000000",dtp->Year, dtp->Month, dtp->Day ); |
1223 | } else { | 1228 | } else { |
1224 | TIM2.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); | 1229 | TIM2.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); |
1225 | 1230 | ||
1226 | } | 1231 | } |
1227 | //printmsg("Stop : %s\n",OSDateTime(Note->Entries[i].Date,false)); | 1232 | //printmsg("Stop : %s\n",OSDateTime(Note->Entries[i].Date,false)); |
1228 | //memcpy(&DateTime,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | 1233 | //memcpy(&DateTime,&Note->Entries[i].Date,sizeof(GSM_DateTime)); |
1229 | break; | 1234 | break; |
1230 | case CAL_ALARM_DATETIME: | 1235 | case CAL_ALARM_DATETIME: |
1231 | ARON = "0"; | 1236 | ARON = "0"; |
1232 | dtp = &Note->Entries[i].Date ; | 1237 | dtp = &Note->Entries[i].Date ; |
1233 | ARMN.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); | 1238 | ARMN.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); |
1234 | //printmsg("Tone alarm : %s\n",OSDateTime(Note->Entries[i].Date,false)); | 1239 | //printmsg("Tone alarm : %s\n",OSDateTime(Note->Entries[i].Date,false)); |
1235 | memcpy(&Alarm,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | 1240 | memcpy(&Alarm,&Note->Entries[i].Date,sizeof(GSM_DateTime)); |
1236 | break; | 1241 | break; |
1237 | case CAL_SILENT_ALARM_DATETIME: | 1242 | case CAL_SILENT_ALARM_DATETIME: |
1238 | ARON = "0"; | 1243 | ARON = "0"; |
1239 | dtp = &Note->Entries[i].Date ; | 1244 | dtp = &Note->Entries[i].Date ; |
1240 | ARMN.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); | 1245 | ARMN.sprintf("%04d%02d%02dT%02d%02d%02d",dtp->Year, dtp->Month, dtp->Day, dtp->Hour - dtp->Timezone, dtp->Minute, dtp->Second ); |
1241 | //printmsg("Silent alarm : %s\n",OSDateTime(Note->Entries[i].Date,false)); | 1246 | //printmsg("Silent alarm : %s\n",OSDateTime(Note->Entries[i].Date,false)); |
1242 | //memcpy(&Alarm,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | 1247 | //memcpy(&Alarm,&Note->Entries[i].Date,sizeof(GSM_DateTime)); |
1243 | break; | 1248 | break; |
1244 | case CAL_RECURRANCE: | 1249 | case CAL_RECURRANCE: |
1245 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); | 1250 | //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); |
1246 | break; | 1251 | break; |
1247 | case CAL_TEXT: | 1252 | case CAL_TEXT: |
1248 | DSRP = QString ( (const char*) Note->Entries[i].Text ); | 1253 | DSRP = QString ( (const char*) Note->Entries[i].Text ); |
1249 | break; | 1254 | break; |
1250 | case CAL_LOCATION: | 1255 | case CAL_LOCATION: |
1251 | PLCE = QString ((const char*) Note->Entries[i].Text ); | 1256 | PLCE = QString ((const char*) Note->Entries[i].Text ); |
1252 | break; | 1257 | break; |
1253 | case CAL_PHONE: | 1258 | case CAL_PHONE: |
1254 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | 1259 | //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); |
1255 | break; | 1260 | break; |
1256 | case CAL_PRIVATE: | 1261 | case CAL_PRIVATE: |
1257 | //printmsg("Private : %s\n",Note->Entries[i].Number == 1 ? "Yes" : "No"); | 1262 | //printmsg("Private : %s\n",Note->Entries[i].Number == 1 ? "Yes" : "No"); |
1258 | break; | 1263 | break; |
1259 | case CAL_CONTACTID: | 1264 | case CAL_CONTACTID: |
1260 | #if 0 | 1265 | #if 0 |
1261 | entry.Location = Note->Entries[i].Number; | 1266 | entry.Location = Note->Entries[i].Number; |
1262 | entry.MemoryType = MEM_ME; | 1267 | entry.MemoryType = MEM_ME; |
1263 | error=Phone->GetMemory(&s, &entry); | 1268 | error=Phone->GetMemory(&s, &entry); |
1264 | if (error == ERR_NONE) { | 1269 | if (error == ERR_NONE) { |
1265 | name = GSM_PhonebookGetEntryName(&entry); | 1270 | name = GSM_PhonebookGetEntryName(&entry); |
1266 | if (name != NULL) { | 1271 | if (name != NULL) { |
1267 | //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); | 1272 | //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); |
1268 | } else { | 1273 | } else { |
1269 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); | 1274 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); |
1270 | } | 1275 | } |
1271 | } else { | 1276 | } else { |
1272 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); | 1277 | //printmsg("Contact ID : %d\n",Note->Entries[i].Number); |
1273 | } | 1278 | } |
1274 | #endif | 1279 | #endif |
1275 | break; | 1280 | break; |
1276 | case CAL_REPEAT_DAYOFWEEK: | 1281 | case CAL_REPEAT_DAYOFWEEK: |
1277 | repeat_dayofweek = Note->Entries[i].Number; | 1282 | repeat_dayofweek = Note->Entries[i].Number; |
1278 | repeating = true; | 1283 | repeating = true; |
1279 | break; | 1284 | break; |
1280 | case CAL_REPEAT_DAY: | 1285 | case CAL_REPEAT_DAY: |
1281 | repeat_day = Note->Entries[i].Number; | 1286 | repeat_day = Note->Entries[i].Number; |
1282 | repeating = true; | 1287 | repeating = true; |
1283 | break; | 1288 | break; |
1284 | case CAL_REPEAT_WEEKOFMONTH: | 1289 | case CAL_REPEAT_WEEKOFMONTH: |
1285 | repeat_weekofmonth = Note->Entries[i].Number; | 1290 | repeat_weekofmonth = Note->Entries[i].Number; |
1286 | repeating = true; | 1291 | repeating = true; |
1287 | break; | 1292 | break; |
1288 | case CAL_REPEAT_MONTH: | 1293 | case CAL_REPEAT_MONTH: |
1289 | repeat_month = Note->Entries[i].Number; | 1294 | repeat_month = Note->Entries[i].Number; |
1290 | repeating = true; | 1295 | repeating = true; |
1291 | break; | 1296 | break; |
1292 | case CAL_REPEAT_FREQUENCY: | 1297 | case CAL_REPEAT_FREQUENCY: |
1293 | repeat_frequency = Note->Entries[i].Number; | 1298 | repeat_frequency = Note->Entries[i].Number; |
1294 | repeating = true; | 1299 | repeating = true; |
1295 | break; | 1300 | break; |
1296 | case CAL_REPEAT_STARTDATE: | 1301 | case CAL_REPEAT_STARTDATE: |
1297 | repeat_startdate = Note->Entries[i].Date; | 1302 | repeat_startdate = Note->Entries[i].Date; |
1298 | repeating = true; | 1303 | repeating = true; |
1299 | break; | 1304 | break; |
1300 | case CAL_REPEAT_STOPDATE: | 1305 | case CAL_REPEAT_STOPDATE: |
1301 | repeat_stopdate = Note->Entries[i].Date; | 1306 | repeat_stopdate = Note->Entries[i].Date; |
1302 | repeating = true; | 1307 | repeating = true; |
1303 | break; | 1308 | break; |
1304 | } | 1309 | } |
1305 | } | 1310 | } |
1306 | 1311 | ||
1307 | 1312 | ||
1308 | 1313 | ||
1309 | if ( ARON == "0" ) { | 1314 | if ( ARON == "0" ) { |
1310 | QDateTime start,alarm; | 1315 | QDateTime start,alarm; |
1311 | start = handler.fromString( TIM1 ); | 1316 | start = handler.fromString( TIM1 ); |
1312 | alarm = handler.fromString( ARMN ); | 1317 | alarm = handler.fromString( ARMN ); |
1313 | int min = alarm.secsTo ( start )/60; | 1318 | int min = alarm.secsTo ( start )/60; |
1314 | ARMN = QString::number ( min ); | 1319 | ARMN = QString::number ( min ); |
1315 | } | 1320 | } |
1316 | 1321 | ||
1317 | templist.clear(); | 1322 | templist.clear(); |
1318 | templist << CARDID << CATEGORY << DSRP << PLCE << MEM1 << TIM1 << TIM2 << ADAY << ARON << ARMN << ARSD << RTYP << RFRQ << RPOS << RDYS << REND << REDT << ALSD << ALED << MDAY; | 1323 | templist << CARDID << CATEGORY << DSRP << PLCE << MEM1 << TIM1 << TIM2 << ADAY << ARON << ARMN << ARSD << RTYP << RFRQ << RPOS << RDYS << REND << REDT << ALSD << ALED << MDAY; |
1319 | handler.startElement( existingCalendar, templist, type ); | 1324 | handler.startElement( existingCalendar, templist, type ); |
1320 | } | 1325 | } |
1321 | 1326 | ||
1322 | 1327 | ||
1323 | 1328 | ||
1324 | #if 0 | 1329 | #if 0 |
1325 | // qDebug("test %s ", text.latin1()); | 1330 | // qDebug("test %s ", text.latin1()); |
1326 | QStringList templist; | 1331 | QStringList templist; |
1327 | QString tempString; | 1332 | QString tempString; |
1328 | int start = 0; | 1333 | int start = 0; |
1329 | int len = text.length(); | 1334 | int len = text.length(); |
1330 | int end = text.find ("\n",start)+1; | 1335 | int end = text.find ("\n",start)+1; |
1331 | bool ok = true; | 1336 | bool ok = true; |
1332 | start = end; | 1337 | start = end; |
1333 | SharpParser handler( calendar ); | 1338 | PhoneParser handler( calendar ); |
1334 | handler.setCategoriesList( mCategories ); | 1339 | handler.setCategoriesList( mCategories ); |
1335 | while ( start > 0 ) { | 1340 | while ( start > 0 ) { |
1336 | templist.clear(); | 1341 | templist.clear(); |
1337 | ok = true; | 1342 | ok = true; |
1338 | while ( ok ) { | 1343 | while ( ok ) { |
1339 | tempString = getPart( text, ok, start ); | 1344 | tempString = getPart( text, ok, start ); |
1340 | if ( start >= len || start == 0 ) { | 1345 | if ( start >= len || start == 0 ) { |
1341 | start = 0; | 1346 | start = 0; |
1342 | ok = false; | 1347 | ok = false; |
1343 | } | 1348 | } |
1344 | if ( tempString.right(1) =="\n" ) | 1349 | if ( tempString.right(1) =="\n" ) |
1345 | tempString = tempString.left( tempString.length()-1); | 1350 | tempString = tempString.left( tempString.length()-1); |
1346 | //if ( ok ) | 1351 | //if ( ok ) |
1347 | templist.append( tempString ); | 1352 | templist.append( tempString ); |
1348 | //qDebug("%d ---%s---", templist.count(),tempString.latin1() ); | 1353 | //qDebug("%d ---%s---", templist.count(),tempString.latin1() ); |
1349 | } | 1354 | } |
1350 | handler.startElement( existingCalendar, templist, type ); | 1355 | handler.startElement( existingCalendar, templist, type ); |
1351 | } | 1356 | } |
1352 | #endif | 1357 | #endif |
1353 | return false; | 1358 | return false; |
1354 | } | 1359 | } |
1355 | 1360 | ||
1356 | QString SharpFormat::toString( Calendar * ) | 1361 | QString PhoneFormat::toString( Calendar * ) |
1357 | { | 1362 | { |
1358 | return QString::null; | 1363 | return QString::null; |
1359 | } | 1364 | } |
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index f4cb52c..4ddf6f0 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h | |||
@@ -1,65 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #ifndef SHARPFORMAT_H | 21 | #ifndef PHONEFORMAT_H |
22 | #define SHARPAFORMAT_H | 22 | #define PHONEFORMAT_H |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | 25 | ||
26 | #include "scheduler.h" | 26 | #include "scheduler.h" |
27 | 27 | ||
28 | #include "calformat.h" | 28 | #include "calformat.h" |
29 | extern "C" { | 29 | extern "C" { |
30 | #include "gammu.h" | 30 | #include "../gammu/emb/common/gammu.h" |
31 | } | 31 | } |
32 | 32 | ||
33 | namespace KCal { | 33 | namespace KCal { |
34 | 34 | ||
35 | /** | 35 | /** |
36 | This class implements the calendar format used by Sharp. | 36 | This class implements the calendar format used by Phone. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | class SharpFormat : public QObject { | 39 | class PhoneFormat : public QObject { |
40 | public: | 40 | public: |
41 | /** Create new iCalendar format. */ | 41 | /** Create new iCalendar format. */ |
42 | SharpFormat(); | 42 | PhoneFormat(); |
43 | virtual ~SharpFormat(); | 43 | virtual ~PhoneFormat(); |
44 | 44 | ||
45 | bool load( Calendar * ,Calendar *); | 45 | bool load( Calendar * ,Calendar *); |
46 | bool save( Calendar * ); | 46 | bool save( Calendar * ); |
47 | void setCategoriesList ( QStringList * cat ){ mCategories = cat; } | 47 | void setCategoriesList ( QStringList * cat ){ mCategories = cat; } |
48 | bool fromString2Cal( Calendar *, Calendar *, GSM_StateMachine*s , const QString & ); | 48 | bool fromString2Cal( Calendar *, Calendar *, GSM_StateMachine*s , const QString & ); |
49 | bool fromString( Calendar *, const QString & ); | 49 | bool fromString( Calendar *, const QString & ); |
50 | QString toString( Calendar * ); | 50 | QString toString( Calendar * ); |
51 | static ulong getCsum( const QStringList & ); | 51 | static ulong getCsum( const QStringList & ); |
52 | 52 | ||
53 | private: | 53 | private: |
54 | QString getEventString( Event* ); | 54 | QString getEventString( Event* ); |
55 | QString getTodoString( Todo* ); | 55 | QString getTodoString( Todo* ); |
56 | QString dtToString( const QDateTime& dt, bool useTZ = true ); | 56 | QString dtToString( const QDateTime& dt, bool useTZ = true ); |
57 | 57 | ||
58 | QStringList *mCategories; | 58 | QStringList *mCategories; |
59 | int getNumFromRecord( QString answer,Incidence* inc ) ; | 59 | int getNumFromRecord( QString answer,Incidence* inc ) ; |
60 | QString getPart( const QString & text, bool &ok, int &start ); | 60 | QString getPart( const QString & text, bool &ok, int &start ); |
61 | }; | 61 | }; |
62 | 62 | ||
63 | } | 63 | } |
64 | 64 | ||
65 | #endif | 65 | #endif |