author | zautrix <zautrix> | 2004-10-20 12:05:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 12:05:18 (UTC) |
commit | 5cf3c1bce58a6487af166e637e54571e98156fd0 (patch) (unidiff) | |
tree | 2e1ba14350aa322bb21729cf462b96e658fa6929 /korganizer | |
parent | e2a0df411042d986adb31b28f9e0a2f17395358c (diff) | |
download | kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.zip kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.gz kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.bz2 |
OL import fixes
-rw-r--r-- | korganizer/koimportoldialog.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp index 0a3c2d5..c0bde0d 100644 --- a/korganizer/koimportoldialog.cpp +++ b/korganizer/koimportoldialog.cpp | |||
@@ -2,64 +2,65 @@ | |||
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qprogressbar.h> | 28 | #include <qprogressbar.h> |
29 | #include <qwidgetstack.h> | 29 | #include <qwidgetstack.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qhbox.h> | 33 | #include <qhbox.h> |
34 | #include <qregexp.h> | ||
34 | #include <qheader.h> | 35 | #include <qheader.h> |
35 | #include <qdatetime.h> | 36 | #include <qdatetime.h> |
36 | #include <qlistview.h> | 37 | #include <qlistview.h> |
37 | 38 | ||
38 | #include <kdebug.h> | 39 | #include <kdebug.h> |
39 | #include <klocale.h> | 40 | #include <klocale.h> |
40 | #include <kstandarddirs.h> | 41 | #include <kstandarddirs.h> |
41 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
42 | #include <kfiledialog.h> | 43 | #include <kfiledialog.h> |
43 | 44 | ||
44 | #include <libkdepim/categoryselectdialog.h> | 45 | #include <libkdepim/categoryselectdialog.h> |
45 | #include <libkdepim/kinputdialog.h> | 46 | #include <libkdepim/kinputdialog.h> |
46 | 47 | ||
47 | #include <libkcal/calendarlocal.h> | 48 | #include <libkcal/calendarlocal.h> |
48 | #include <libkcal/icalformat.h> | 49 | #include <libkcal/icalformat.h> |
49 | #include <kabc/stdaddressbook.h> | 50 | #include <kabc/stdaddressbook.h> |
50 | 51 | ||
51 | #include "koprefs.h" | 52 | #include "koprefs.h" |
52 | #include "koglobals.h" | 53 | #include "koglobals.h" |
53 | 54 | ||
54 | #include "koimportoldialog.h" | 55 | #include "koimportoldialog.h" |
55 | 56 | ||
56 | #include "../outport/msoutl9.h" | 57 | #include "../outport/msoutl9.h" |
57 | #include <ole2.h> | 58 | #include <ole2.h> |
58 | #include <comutil.h> | 59 | #include <comutil.h> |
59 | _Application gOlApp; | 60 | _Application gOlApp; |
60 | 61 | ||
61 | QDateTime mDdate2Qdtr( DATE dt) | 62 | QDateTime mDdate2Qdtr( DATE dt) |
62 | { | 63 | { |
63 | COleDateTime odt; | 64 | COleDateTime odt; |
64 | SYSTEMTIME st; | 65 | SYSTEMTIME st; |
65 | odt = dt; | 66 | odt = dt; |
@@ -221,65 +222,65 @@ void KOImportOLdialog::readCalendarData( DWORD folder ) | |||
221 | for(i=1; i <= folderItems.GetCount(); ++i) | 222 | for(i=1; i <= folderItems.GetCount(); ++i) |
222 | { | 223 | { |
223 | qApp->processEvents(); | 224 | qApp->processEvents(); |
224 | if ( ! bar.isVisible() ) | 225 | if ( ! bar.isVisible() ) |
225 | return ; | 226 | return ; |
226 | bar.setProgress( i ); | 227 | bar.setProgress( i ); |
227 | indx = (long)i; | 228 | indx = (long)i; |
228 | itm = folderItems.Item(indx.Detach()); | 229 | itm = folderItems.Item(indx.Detach()); |
229 | _AppointmentItem * pItem = (_AppointmentItem *)&itm; | 230 | _AppointmentItem * pItem = (_AppointmentItem *)&itm; |
230 | ol2kopiCalendar( pItem ); | 231 | ol2kopiCalendar( pItem ); |
231 | itm->Release(); | 232 | itm->Release(); |
232 | } | 233 | } |
233 | } | 234 | } |
234 | void KOImportOLdialog::slotOk() | 235 | void KOImportOLdialog::slotOk() |
235 | { | 236 | { |
236 | QDialog::accept(); | 237 | QDialog::accept(); |
237 | } | 238 | } |
238 | 239 | ||
239 | void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) | 240 | void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) |
240 | { | 241 | { |
241 | KCal::Event* event = new KCal::Event(); | 242 | KCal::Event* event = new KCal::Event(); |
242 | if ( aItem->GetAllDayEvent() ){ | 243 | if ( aItem->GetAllDayEvent() ){ |
243 | event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); | 244 | event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); |
244 | event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); | 245 | event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); |
245 | event->setFloats( true ); | 246 | event->setFloats( true ); |
246 | } else { | 247 | } else { |
247 | event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); | 248 | event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); |
248 | event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); | 249 | event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); |
249 | event->setFloats( false ); | 250 | event->setFloats( false ); |
250 | } | 251 | } |
251 | event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) ); | 252 | event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) ); |
252 | event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) ); | 253 | event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) ); |
253 | event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()) ); | 254 | event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()).replace( QRegExp("\\r"), "") ); |
254 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); | 255 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); |
255 | event->setCategories( QStringList::split( ";", cat )); | 256 | event->setCategories( QStringList::split( ";", cat )); |
256 | if ( aItem->GetReminderSet() ) { | 257 | if ( aItem->GetReminderSet() ) { |
257 | event->clearAlarms(); | 258 | event->clearAlarms(); |
258 | Alarm* alarm = event->newAlarm(); | 259 | Alarm* alarm = event->newAlarm(); |
259 | alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); | 260 | alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); |
260 | alarm->setEnabled( true ); | 261 | alarm->setEnabled( true ); |
261 | if ( aItem->GetReminderPlaySound() ) { | 262 | if ( aItem->GetReminderPlaySound() ) { |
262 | alarm->setType( Alarm::Audio ); | 263 | alarm->setType( Alarm::Audio ); |
263 | alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); | 264 | alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); |
264 | } | 265 | } |
265 | else | 266 | else |
266 | alarm->setType( Alarm::Display ); | 267 | alarm->setType( Alarm::Display ); |
267 | alarm->setRepeatCount( aItem->GetReplyTime() ); | 268 | alarm->setRepeatCount( aItem->GetReplyTime() ); |
268 | } | 269 | } |
269 | // OL :pub 0 - pers 1 - priv 2 - conf 3 | 270 | // OL :pub 0 - pers 1 - priv 2 - conf 3 |
270 | // KO : pub 0 - priv 1 - conf 2 | 271 | // KO : pub 0 - priv 1 - conf 2 |
271 | int sec = aItem->GetSensitivity() ; | 272 | int sec = aItem->GetSensitivity() ; |
272 | if ( sec > 1 )// mapping pers -> private | 273 | if ( sec > 1 )// mapping pers -> private |
273 | --sec; | 274 | --sec; |
274 | event->setSecrecy( sec ); | 275 | event->setSecrecy( sec ); |
275 | if ( aItem->GetBusyStatus() == 0 ) | 276 | if ( aItem->GetBusyStatus() == 0 ) |
276 | event->setTransparency( Event::Transparent);// OL free | 277 | event->setTransparency( Event::Transparent);// OL free |
277 | else | 278 | else |
278 | event->setTransparency( Event::Opaque);//OL all other | 279 | event->setTransparency( Event::Opaque);//OL all other |
279 | 280 | ||
280 | if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur | 281 | if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur |
281 | 282 | ||
282 | RecurrencePattern recpat = aItem->GetRecurrencePattern(); | 283 | RecurrencePattern recpat = aItem->GetRecurrencePattern(); |
283 | 284 | ||
284 | QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); | 285 | QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); |
285 | int freq = recpat.GetInterval(); | 286 | int freq = recpat.GetInterval(); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9e215b9..63484d6 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -259,83 +259,89 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
259 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 259 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
260 | mSyncManager->setDefaultFileName( defaultFileName()); | 260 | mSyncManager->setDefaultFileName( defaultFileName()); |
261 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 261 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
262 | mSyncManager->fillSyncMenu(); | 262 | mSyncManager->fillSyncMenu(); |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 266 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
267 | if ( showWarning ) { | 267 | if ( showWarning ) { |
268 | KMessageBox::information( this, | 268 | KMessageBox::information( this, |
269 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 269 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
270 | qApp->processEvents(); | 270 | qApp->processEvents(); |
271 | mView->dialogManager()->showSyncOptions(); | 271 | mView->dialogManager()->showSyncOptions(); |
272 | } | 272 | } |
273 | 273 | ||
274 | //US listen for result adressed from Ka/Pi | 274 | //US listen for result adressed from Ka/Pi |
275 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
276 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 276 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
277 | #endif | 277 | #endif |
278 | #ifndef DESKTOP_VERSION | 278 | #ifndef DESKTOP_VERSION |
279 | infrared = 0; | 279 | infrared = 0; |
280 | #endif | 280 | #endif |
281 | 281 | ||
282 | mBRdisabled = false; | 282 | mBRdisabled = false; |
283 | toggleBeamReceive(); | 283 | toggleBeamReceive(); |
284 | } | 284 | } |
285 | MainWindow::~MainWindow() | 285 | MainWindow::~MainWindow() |
286 | { | 286 | { |
287 | //qDebug("MainWindow::~MainWindow() "); | 287 | //qDebug("MainWindow::~MainWindow() "); |
288 | //save toolbar location | 288 | //save toolbar location |
289 | delete mCalendar; | 289 | delete mCalendar; |
290 | delete mSyncManager; | 290 | delete mSyncManager; |
291 | #ifndef DESKTOP_VERSION | ||
291 | if ( infrared ) | 292 | if ( infrared ) |
292 | delete infrared; | 293 | delete infrared; |
294 | #endif | ||
293 | 295 | ||
294 | 296 | ||
295 | } | 297 | } |
296 | 298 | ||
297 | void MainWindow::disableBR(bool b) | 299 | void MainWindow::disableBR(bool b) |
298 | { | 300 | { |
301 | #ifndef DESKTOP_VERSION | ||
299 | if ( b ) { | 302 | if ( b ) { |
300 | if ( infrared ) { | 303 | if ( infrared ) { |
301 | toggleBeamReceive(); | 304 | toggleBeamReceive(); |
302 | mBRdisabled = true; | 305 | mBRdisabled = true; |
303 | } | 306 | } |
307 | mBRdisabled = true; | ||
304 | } else { | 308 | } else { |
305 | if ( mBRdisabled ) { | 309 | if ( mBRdisabled ) { |
306 | mBRdisabled = false; | 310 | mBRdisabled = false; |
307 | toggleBeamReceive(); | 311 | //makes no sense,because other cal ap is probably running |
312 | // toggleBeamReceive(); | ||
308 | } | 313 | } |
309 | } | 314 | } |
315 | #endif | ||
310 | 316 | ||
311 | } | 317 | } |
312 | bool MainWindow::beamReceiveEnabled() | 318 | bool MainWindow::beamReceiveEnabled() |
313 | { | 319 | { |
314 | #ifndef DESKTOP_VERSION | 320 | #ifndef DESKTOP_VERSION |
315 | return ( infrared != 0 ); | 321 | return ( infrared != 0 ); |
316 | #endif | 322 | #endif |
317 | return false; | 323 | return false; |
318 | } | 324 | } |
319 | 325 | ||
320 | void MainWindow::toggleBeamReceive() | 326 | void MainWindow::toggleBeamReceive() |
321 | { | 327 | { |
322 | if ( mBRdisabled ) | 328 | if ( mBRdisabled ) |
323 | return; | 329 | return; |
324 | #ifndef DESKTOP_VERSION | 330 | #ifndef DESKTOP_VERSION |
325 | if ( infrared ) { | 331 | if ( infrared ) { |
326 | qDebug("disable BeamReceive "); | 332 | qDebug("disable BeamReceive "); |
327 | delete infrared; | 333 | delete infrared; |
328 | infrared = 0; | 334 | infrared = 0; |
329 | brAction->setOn(false); | 335 | brAction->setOn(false); |
330 | return; | 336 | return; |
331 | } | 337 | } |
332 | qDebug("enable BeamReceive "); | 338 | qDebug("enable BeamReceive "); |
333 | brAction->setOn(true); | 339 | brAction->setOn(true); |
334 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 340 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
335 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 341 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
336 | #endif | 342 | #endif |
337 | } | 343 | } |
338 | void MainWindow::showMaximized () | 344 | void MainWindow::showMaximized () |
339 | { | 345 | { |
340 | #ifndef DESKTOP_VERSION | 346 | #ifndef DESKTOP_VERSION |
341 | if ( ! globalFlagBlockStartup ) | 347 | if ( ! globalFlagBlockStartup ) |