summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-20 12:05:18 (UTC)
committer zautrix <zautrix>2004-10-20 12:05:18 (UTC)
commit5cf3c1bce58a6487af166e637e54571e98156fd0 (patch) (unidiff)
tree2e1ba14350aa322bb21729cf462b96e658fa6929 /korganizer
parente2a0df411042d986adb31b28f9e0a2f17395358c (diff)
downloadkdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.zip
kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.gz
kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.bz2
OL import fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koimportoldialog.cpp3
-rw-r--r--korganizer/mainwindow.cpp8
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
@@ -1,97 +1,98 @@
1/* 1/*
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
61QDateTime mDdate2Qdtr( DATE dt) 62QDateTime mDdate2Qdtr( DATE dt)
62{ 63{
63 COleDateTime odt; 64 COleDateTime odt;
64 SYSTEMTIME st; 65 SYSTEMTIME st;
65 odt = dt; 66 odt = dt;
66 odt.GetAsSystemTime(st); 67 odt.GetAsSystemTime(st);
67 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); 68 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
68 return qdt; 69 return qdt;
69} 70}
70 71
71class OLEListViewItem : public QCheckListItem 72class OLEListViewItem : public QCheckListItem
72{ 73{
73 public: 74 public:
74 OLEListViewItem( QListView *parent, QString text ) : 75 OLEListViewItem( QListView *parent, QString text ) :
75 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; 76 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
76 OLEListViewItem( QListViewItem *after, QString text ) : 77 OLEListViewItem( QListViewItem *after, QString text ) :
77 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; 78 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
78 ~OLEListViewItem() {}; 79 ~OLEListViewItem() {};
79 void setData( DWORD data ) {mData= data; }; 80 void setData( DWORD data ) {mData= data; };
80 DWORD data() { return mData ;}; 81 DWORD data() { return mData ;};
81 private: 82 private:
82 DWORD mData; 83 DWORD mData;
83}; 84};
84 85
85KOImportOLdialog::KOImportOLdialog( const QString &caption, 86KOImportOLdialog::KOImportOLdialog( const QString &caption,
86 Calendar *calendar, QWidget *parent ) : 87 Calendar *calendar, QWidget *parent ) :
87 KDialogBase( Plain, caption, User1 | Close, Ok, 88 KDialogBase( Plain, caption, User1 | Close, Ok,
88 parent, caption, true, false, i18n("Import!") ) 89 parent, caption, true, false, i18n("Import!") )
89{ 90{
90 QHBox * mw = new QHBox( this ); 91 QHBox * mw = new QHBox( this );
91 setMainWidget( mw ); 92 setMainWidget( mw );
92 mListView = new QListView( mw ); 93 mListView = new QListView( mw );
93 mListView->addColumn(i18n("Select Folder to import")); 94 mListView->addColumn(i18n("Select Folder to import"));
94 mListView->addColumn(i18n("Content Type")); 95 mListView->addColumn(i18n("Content Type"));
95 mCalendar = calendar; 96 mCalendar = calendar;
96 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 97 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
97 setupFolderView(); 98 setupFolderView();
@@ -189,129 +190,129 @@ void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent
189void KOImportOLdialog::slotApply() 190void KOImportOLdialog::slotApply()
190{ 191{
191 importedItems = 0; 192 importedItems = 0;
192 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); 193 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
193 while ( child ) { 194 while ( child ) {
194 if ( child->isOn() ) 195 if ( child->isOn() )
195 readCalendarData( child->data() ); 196 readCalendarData( child->data() );
196 child = (OLEListViewItem*) child->itemBelow(); 197 child = (OLEListViewItem*) child->itemBelow();
197 } 198 }
198 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 199 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
199 KMessageBox::information(this,mes); 200 KMessageBox::information(this,mes);
200} 201}
201void KOImportOLdialog::readCalendarData( DWORD folder ) 202void KOImportOLdialog::readCalendarData( DWORD folder )
202{ 203{
203 204
204 LPDISPATCH dispItem = (LPDISPATCH)folder; 205 LPDISPATCH dispItem = (LPDISPATCH)folder;
205 dispItem->AddRef(); 206 dispItem->AddRef();
206 MAPIFolder mf(dispItem); 207 MAPIFolder mf(dispItem);
207 mf.m_lpDispatch->AddRef(); 208 mf.m_lpDispatch->AddRef();
208 _Items folderItems; 209 _Items folderItems;
209 _variant_t indx((long)0); 210 _variant_t indx((long)0);
210 LPDISPATCH itm; 211 LPDISPATCH itm;
211 int i; 212 int i;
212 folderItems = mf.GetItems(); 213 folderItems = mf.GetItems();
213 QProgressBar bar( folderItems.GetCount(),0 ); 214 QProgressBar bar( folderItems.GetCount(),0 );
214 bar.setCaption (i18n("Importing - close to abort!") ); 215 bar.setCaption (i18n("Importing - close to abort!") );
215 int h = bar.sizeHint().height() ; 216 int h = bar.sizeHint().height() ;
216 int w = 300; 217 int w = 300;
217 int dw = QApplication::desktop()->width(); 218 int dw = QApplication::desktop()->width();
218 int dh = QApplication::desktop()->height(); 219 int dh = QApplication::desktop()->height();
219 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 220 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
220 bar.show(); 221 bar.show();
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}
234void KOImportOLdialog::slotOk() 235void KOImportOLdialog::slotOk()
235{ 236{
236 QDialog::accept(); 237 QDialog::accept();
237} 238}
238 239
239void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) 240void 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();
286 287
287 bool hasEndDate = !recpat.GetNoEndDate(); 288 bool hasEndDate = !recpat.GetNoEndDate();
288 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date(); 289 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date();
289 QBitArray weekDays( 7 ); 290 QBitArray weekDays( 7 );
290 weekDays.fill(false ); 291 weekDays.fill(false );
291 uint weekDaysNum = recpat.GetDayOfWeekMask(); 292 uint weekDaysNum = recpat.GetDayOfWeekMask();
292 int i; 293 int i;
293 int bb = 2; 294 int bb = 2;
294 for( i = 1; i <= 6; ++i ) { 295 for( i = 1; i <= 6; ++i ) {
295 weekDays.setBit( i - 1, ( bb & weekDaysNum )); 296 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
296 bb = 4 << (i-1); 297 bb = 4 << (i-1);
297 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); 298 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
298 } 299 }
299 if ( 1 & weekDaysNum) 300 if ( 1 & weekDaysNum)
300 weekDays.setBit( 6 ); 301 weekDays.setBit( 6 );
301 // int pos = 1;// pending 302 // int pos = 1;// pending
302 303
303 Recurrence *r = event->recurrence(); 304 Recurrence *r = event->recurrence();
304 int rtype = recpat.GetRecurrenceType(); 305 int rtype = recpat.GetRecurrenceType();
305 //recurrence types are: 306 //recurrence types are:
306 /* 307 /*
307 olRecursDaily(0) 308 olRecursDaily(0)
308 olRecursWeekly(1) 309 olRecursWeekly(1)
309 olRecursMonthly(2) 310 olRecursMonthly(2)
310 olRecursMonthNth(3) 311 olRecursMonthNth(3)
311 olRecursYearly(5) 312 olRecursYearly(5)
312 olRecursYearNth(6) 313 olRecursYearNth(6)
313 */ 314 */
314 315
315 int duration = recpat.GetOccurrences(); 316 int duration = recpat.GetOccurrences();
316 if ( !hasEndDate ) 317 if ( !hasEndDate )
317 duration = -1; 318 duration = -1;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e215b9..63484d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -227,147 +227,153 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
227 227
228 if ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KOPrefs::instance()->mLanguageChanged ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false; 231 KOPrefs::instance()->mLanguageChanged = false;
232 } 232 }
233 processIncidenceSelection( 0 ); 233 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( mView, SIGNAL( tempDisableBR(bool) ), 240 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) ); 241 SLOT( disableBR(bool) ) );
242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
243 mView->setModified( false ); 243 mView->setModified( false );
244 mBlockAtStartup = false; 244 mBlockAtStartup = false;
245 mView->setModified( false ); 245 mView->setModified( false );
246 setCentralWidget( mView ); 246 setCentralWidget( mView );
247 globalFlagBlockStartup = 0; 247 globalFlagBlockStartup = 0;
248 mView->show(); 248 mView->show();
249 delete splash; 249 delete splash;
250 if ( newFile ) 250 if ( newFile )
251 mView->updateConfig(); 251 mView->updateConfig();
252 // qApp->processEvents(); 252 // qApp->processEvents();
253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
254 //fillSyncMenu(); 254 //fillSyncMenu();
255 255
256 256
257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
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}
285MainWindow::~MainWindow() 285MainWindow::~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
297void MainWindow::disableBR(bool b) 299void 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}
312bool MainWindow::beamReceiveEnabled() 318bool 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
320void MainWindow::toggleBeamReceive() 326void 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}
338void MainWindow::showMaximized () 344void MainWindow::showMaximized ()
339{ 345{
340#ifndef DESKTOP_VERSION 346#ifndef DESKTOP_VERSION
341 if ( ! globalFlagBlockStartup ) 347 if ( ! globalFlagBlockStartup )
342 if ( mClosed ) 348 if ( mClosed )
343 mView->goToday(); 349 mView->goToday();
344#endif 350#endif
345 QWidget::showMaximized () ; 351 QWidget::showMaximized () ;
346 mClosed = false; 352 mClosed = false;
347} 353}
348void MainWindow::closeEvent( QCloseEvent* ce ) 354void MainWindow::closeEvent( QCloseEvent* ce )
349{ 355{
350 356
351 357
352 358
353 if ( ! KOPrefs::instance()->mAskForQuit ) { 359 if ( ! KOPrefs::instance()->mAskForQuit ) {
354 saveOnClose(); 360 saveOnClose();
355 mClosed = true; 361 mClosed = true;
356 ce->accept(); 362 ce->accept();
357 return; 363 return;
358 364
359 } 365 }
360 366
361 switch( QMessageBox::information( this, "KO/Pi", 367 switch( QMessageBox::information( this, "KO/Pi",
362 i18n("Do you really want\nto close KO/Pi?"), 368 i18n("Do you really want\nto close KO/Pi?"),
363 i18n("Close"), i18n("No"), 369 i18n("Close"), i18n("No"),
364 0, 0 ) ) { 370 0, 0 ) ) {
365 case 0: 371 case 0:
366 saveOnClose(); 372 saveOnClose();
367 mClosed = true; 373 mClosed = true;
368 ce->accept(); 374 ce->accept();
369 break; 375 break;
370 case 1: 376 case 1:
371 ce->ignore(); 377 ce->ignore();
372 break; 378 break;
373 case 2: 379 case 2: