-rw-r--r-- | korganizer/calendarview.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1d62046..e4c067e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -82,124 +82,129 @@ | |||
82 | #include "../kalarmd/alarmdialog.h" | 82 | #include "../kalarmd/alarmdialog.h" |
83 | 83 | ||
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | #include <libkcal/sharpformat.h> | 85 | #include <libkcal/sharpformat.h> |
86 | #include <externalapphandler.h> | 86 | #include <externalapphandler.h> |
87 | #endif | 87 | #endif |
88 | #include <libkcal/phoneformat.h> | 88 | #include <libkcal/phoneformat.h> |
89 | #ifndef KORG_NOMAIL | 89 | #ifndef KORG_NOMAIL |
90 | #include "komailclient.h" | 90 | #include "komailclient.h" |
91 | #endif | 91 | #endif |
92 | #ifndef KORG_NOPRINTER | 92 | #ifndef KORG_NOPRINTER |
93 | #include "calprinter.h" | 93 | #include "calprinter.h" |
94 | #endif | 94 | #endif |
95 | #ifndef KORG_NOPLUGINS | 95 | #ifndef KORG_NOPLUGINS |
96 | #include "kocore.h" | 96 | #include "kocore.h" |
97 | #endif | 97 | #endif |
98 | #include "koeventeditor.h" | 98 | #include "koeventeditor.h" |
99 | #include "kotodoeditor.h" | 99 | #include "kotodoeditor.h" |
100 | #include "koprefs.h" | 100 | #include "koprefs.h" |
101 | #include "koeventviewerdialog.h" | 101 | #include "koeventviewerdialog.h" |
102 | #include "publishdialog.h" | 102 | #include "publishdialog.h" |
103 | #include "kofilterview.h" | 103 | #include "kofilterview.h" |
104 | #include "koglobals.h" | 104 | #include "koglobals.h" |
105 | #include "koviewmanager.h" | 105 | #include "koviewmanager.h" |
106 | #include "koagendaview.h" | 106 | #include "koagendaview.h" |
107 | #include "kodialogmanager.h" | 107 | #include "kodialogmanager.h" |
108 | #include "outgoingdialog.h" | 108 | #include "outgoingdialog.h" |
109 | #include "incomingdialog.h" | 109 | #include "incomingdialog.h" |
110 | #include "statusdialog.h" | 110 | #include "statusdialog.h" |
111 | #include "kdatenavigator.h" | 111 | #include "kdatenavigator.h" |
112 | #include "kotodoview.h" | 112 | #include "kotodoview.h" |
113 | #include "datenavigator.h" | 113 | #include "datenavigator.h" |
114 | #include "resourceview.h" | 114 | #include "resourceview.h" |
115 | #include "navigatorbar.h" | 115 | #include "navigatorbar.h" |
116 | #include "searchdialog.h" | 116 | #include "searchdialog.h" |
117 | #include "mainwindow.h" | 117 | #include "mainwindow.h" |
118 | 118 | ||
119 | #include "calendarview.h" | 119 | #include "calendarview.h" |
120 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
121 | #include <qtopia/alarmserver.h> | 121 | #include <qtopia/alarmserver.h> |
122 | #endif | 122 | #endif |
123 | #ifndef _WIN32_ | 123 | #ifndef _WIN32_ |
124 | #include <stdlib.h> | 124 | #include <stdlib.h> |
125 | #include <stdio.h> | 125 | #include <stdio.h> |
126 | #include <unistd.h> | 126 | #include <unistd.h> |
127 | #else | 127 | #else |
128 | #include <qprocess.h> | 128 | #include <qprocess.h> |
129 | #endif | 129 | #endif |
130 | #ifdef DESKTOP_VERSION | ||
131 | #include <kabc/stdaddressbook.h> | ||
132 | #endif | ||
130 | using namespace KOrg; | 133 | using namespace KOrg; |
131 | using namespace KCal; | 134 | using namespace KCal; |
132 | extern int globalFlagBlockAgenda; | 135 | extern int globalFlagBlockAgenda; |
133 | extern int globalFlagBlockStartup; | 136 | extern int globalFlagBlockStartup; |
134 | 137 | ||
135 | 138 | ||
136 | 139 | ||
137 | class KOBeamPrefs : public QDialog | 140 | class KOBeamPrefs : public QDialog |
138 | { | 141 | { |
139 | public: | 142 | public: |
140 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 143 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
141 | QDialog( parent, name, true ) | 144 | QDialog( parent, name, true ) |
142 | { | 145 | { |
143 | setCaption( i18n("Beam Options") ); | 146 | setCaption( i18n("Beam Options") ); |
144 | QVBoxLayout* lay = new QVBoxLayout( this ); | 147 | QVBoxLayout* lay = new QVBoxLayout( this ); |
145 | lay->setSpacing( 3 ); | 148 | lay->setSpacing( 3 ); |
146 | lay->setMargin( 3 ); | 149 | lay->setMargin( 3 ); |
147 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 150 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
148 | lay->addWidget( format ); | 151 | lay->addWidget( format ); |
149 | format->setExclusive ( true ) ; | 152 | format->setExclusive ( true ) ; |
150 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 153 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
151 | lay->addWidget( time ); time->setExclusive ( true ) ; | 154 | lay->addWidget( time ); time->setExclusive ( true ) ; |
152 | vcal = new QRadioButton(" vCalendar ", format ); | 155 | vcal = new QRadioButton(" vCalendar ", format ); |
153 | ical = new QRadioButton(" iCalendar ", format ); | 156 | ical = new QRadioButton(" iCalendar ", format ); |
154 | vcal->setChecked( true ); | 157 | vcal->setChecked( true ); |
155 | tz = new QRadioButton(i18n(" With timezone "), time ); | 158 | tz = new QRadioButton(i18n(" With timezone "), time ); |
156 | local = new QRadioButton(i18n(" Local time "), time ); | 159 | local = new QRadioButton(i18n(" Local time "), time ); |
157 | tz->setChecked( true ); | 160 | tz->setChecked( true );#ifdef DESKTOP_VERSION |
161 | #include <kabc/stdaddressbook.h> | ||
162 | #endif | ||
158 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 163 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
159 | lay->addWidget( ok ); | 164 | lay->addWidget( ok ); |
160 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 165 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
161 | lay->addWidget( cancel ); | 166 | lay->addWidget( cancel ); |
162 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 167 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
163 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 168 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
164 | resize( 200, 200 ); | 169 | resize( 200, 200 ); |
165 | } | 170 | } |
166 | 171 | ||
167 | bool beamVcal() { return vcal->isChecked(); } | 172 | bool beamVcal() { return vcal->isChecked(); } |
168 | bool beamLocal() { return local->isChecked(); } | 173 | bool beamLocal() { return local->isChecked(); } |
169 | private: | 174 | private: |
170 | QRadioButton* vcal, *ical, *local, *tz; | 175 | QRadioButton* vcal, *ical, *local, *tz; |
171 | }; | 176 | }; |
172 | class KOCatPrefs : public QDialog | 177 | class KOCatPrefs : public QDialog |
173 | { | 178 | { |
174 | public: | 179 | public: |
175 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 180 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
176 | QDialog( parent, name, true ) | 181 | QDialog( parent, name, true ) |
177 | { | 182 | { |
178 | setCaption( i18n("Manage new Categories") ); | 183 | setCaption( i18n("Manage new Categories") ); |
179 | QVBoxLayout* lay = new QVBoxLayout( this ); | 184 | QVBoxLayout* lay = new QVBoxLayout( this ); |
180 | lay->setSpacing( 3 ); | 185 | lay->setSpacing( 3 ); |
181 | lay->setMargin( 3 ); | 186 | lay->setMargin( 3 ); |
182 | 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 ); | 187 | 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 ); |
183 | lay->addWidget( lab ); | 188 | lay->addWidget( lab ); |
184 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 189 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
185 | lay->addWidget( format ); | 190 | lay->addWidget( format ); |
186 | format->setExclusive ( true ) ; | 191 | format->setExclusive ( true ) ; |
187 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 192 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
188 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 193 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
189 | addCatBut->setChecked( true ); | 194 | addCatBut->setChecked( true ); |
190 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 195 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
191 | lay->addWidget( ok ); | 196 | lay->addWidget( ok ); |
192 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 197 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
193 | lay->addWidget( cancel ); | 198 | lay->addWidget( cancel ); |
194 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 199 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
195 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 200 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
196 | resize( 200, 200 ); | 201 | resize( 200, 200 ); |
197 | } | 202 | } |
198 | 203 | ||
199 | bool addCat() { return addCatBut->isChecked(); } | 204 | bool addCat() { return addCatBut->isChecked(); } |
200 | private: | 205 | private: |
201 | QRadioButton* addCatBut; | 206 | QRadioButton* addCatBut; |
202 | }; | 207 | }; |
203 | 208 | ||
204 | 209 | ||
205 | 210 | ||
@@ -1285,97 +1290,96 @@ void CalendarView::syncExternal( int mode ) | |||
1285 | } | 1290 | } |
1286 | } | 1291 | } |
1287 | #ifndef DESKTOP_VERSION | 1292 | #ifndef DESKTOP_VERSION |
1288 | if ( sharpFormat ) | 1293 | if ( sharpFormat ) |
1289 | sharpFormat->save(calendar); | 1294 | sharpFormat->save(calendar); |
1290 | #endif | 1295 | #endif |
1291 | if ( phoneFormat ) | 1296 | if ( phoneFormat ) |
1292 | phoneFormat->save(calendar); | 1297 | phoneFormat->save(calendar); |
1293 | iL = calendar->rawIncidences(); | 1298 | iL = calendar->rawIncidences(); |
1294 | inc = iL.first(); | 1299 | inc = iL.first(); |
1295 | Incidence* loc; | 1300 | Incidence* loc; |
1296 | while ( inc ) { | 1301 | while ( inc ) { |
1297 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1302 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1298 | loc = mCalendar->incidence(inc->uid() ); | 1303 | loc = mCalendar->incidence(inc->uid() ); |
1299 | if ( loc ) { | 1304 | if ( loc ) { |
1300 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1305 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1301 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1306 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1302 | } | 1307 | } |
1303 | } | 1308 | } |
1304 | inc = iL.next(); | 1309 | inc = iL.next(); |
1305 | } | 1310 | } |
1306 | Incidence* lse = getLastSyncEvent(); | 1311 | Incidence* lse = getLastSyncEvent(); |
1307 | if ( lse ) { | 1312 | if ( lse ) { |
1308 | lse->setReadOnly( false ); | 1313 | lse->setReadOnly( false ); |
1309 | lse->setDescription( "" ); | 1314 | lse->setDescription( "" ); |
1310 | lse->setReadOnly( true ); | 1315 | lse->setReadOnly( true ); |
1311 | } | 1316 | } |
1312 | } | 1317 | } |
1313 | } | 1318 | } |
1314 | setModified( true ); | 1319 | setModified( true ); |
1315 | } else { | 1320 | } else { |
1316 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1321 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1317 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1322 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1318 | question, i18n("Ok")) ; | 1323 | question, i18n("Ok")) ; |
1319 | 1324 | ||
1320 | } | 1325 | } |
1321 | delete calendar; | 1326 | delete calendar; |
1322 | updateView(); | 1327 | updateView(); |
1323 | return ;//syncOK; | 1328 | return ;//syncOK; |
1324 | 1329 | ||
1325 | } | 1330 | } |
1326 | void CalendarView::syncSharp() | 1331 | void CalendarView::syncSharp() |
1327 | { | 1332 | { |
1328 | syncExternal( 0 ); | 1333 | syncExternal( 0 ); |
1329 | 1334 | ||
1330 | } | 1335 | } |
1331 | 1336 | ||
1332 | 1337 | ||
1333 | //#include <kabc/stdaddressbook.h> | ||
1334 | bool CalendarView::importBday() | 1338 | bool CalendarView::importBday() |
1335 | { | 1339 | { |
1336 | #ifndef KORG_NOKABC | 1340 | #ifndef KORG_NOKABC |
1337 | 1341 | ||
1338 | #ifdef DESKTOP_VERSION | 1342 | #ifdef DESKTOP_VERSION |
1339 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1343 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1340 | KABC::AddressBook::Iterator it; | 1344 | KABC::AddressBook::Iterator it; |
1341 | int count = 0; | 1345 | int count = 0; |
1342 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1346 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1343 | ++count; | 1347 | ++count; |
1344 | } | 1348 | } |
1345 | QProgressBar bar(count,0 ); | 1349 | QProgressBar bar(count,0 ); |
1346 | int w = 300; | 1350 | int w = 300; |
1347 | if ( QApplication::desktop()->width() < 320 ) | 1351 | if ( QApplication::desktop()->width() < 320 ) |
1348 | w = 220; | 1352 | w = 220; |
1349 | int h = bar.sizeHint().height() ; | 1353 | int h = bar.sizeHint().height() ; |
1350 | int dw = QApplication::desktop()->width(); | 1354 | int dw = QApplication::desktop()->width(); |
1351 | int dh = QApplication::desktop()->height(); | 1355 | int dh = QApplication::desktop()->height(); |
1352 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1356 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1353 | bar.show(); | 1357 | bar.show(); |
1354 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1358 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1355 | qApp->processEvents(); | 1359 | qApp->processEvents(); |
1356 | count = 0; | 1360 | count = 0; |
1357 | int addCount = 0; | 1361 | int addCount = 0; |
1358 | KCal::Attendee* a = 0; | 1362 | KCal::Attendee* a = 0; |
1359 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1363 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1360 | if ( ! bar.isVisible() ) | 1364 | if ( ! bar.isVisible() ) |
1361 | return false; | 1365 | return false; |
1362 | bar.setProgress( count++ ); | 1366 | bar.setProgress( count++ ); |
1363 | qApp->processEvents(); | 1367 | qApp->processEvents(); |
1364 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1368 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1365 | if ( (*it).birthday().date().isValid() ){ | 1369 | if ( (*it).birthday().date().isValid() ){ |
1366 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1370 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1367 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1371 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1368 | ++addCount; | 1372 | ++addCount; |
1369 | } | 1373 | } |
1370 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1374 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1371 | if ( anni.isValid() ){ | 1375 | if ( anni.isValid() ){ |
1372 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1376 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1373 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1377 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1374 | ++addCount; | 1378 | ++addCount; |
1375 | } | 1379 | } |
1376 | } | 1380 | } |
1377 | updateView(); | 1381 | updateView(); |
1378 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1382 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1379 | #else //DESKTOP_VERSION | 1383 | #else //DESKTOP_VERSION |
1380 | 1384 | ||
1381 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1385 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |