author | zautrix <zautrix> | 2004-10-20 12:05:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 12:05:18 (UTC) |
commit | 5cf3c1bce58a6487af166e637e54571e98156fd0 (patch) (side-by-side diff) | |
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 @@ -1,81 +1,82 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qtooltip.h> #include <qframe.h> #include <qpixmap.h> #include <qlayout.h> #include <qprogressbar.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qdir.h> #include <qapplication.h> #include <qhbox.h> +#include <qregexp.h> #include <qheader.h> #include <qdatetime.h> #include <qlistview.h> #include <kdebug.h> #include <klocale.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <kfiledialog.h> #include <libkdepim/categoryselectdialog.h> #include <libkdepim/kinputdialog.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include <kabc/stdaddressbook.h> #include "koprefs.h" #include "koglobals.h" #include "koimportoldialog.h" #include "../outport/msoutl9.h" #include <ole2.h> #include <comutil.h> _Application gOlApp; QDateTime mDdate2Qdtr( DATE dt) { COleDateTime odt; SYSTEMTIME st; odt = dt; odt.GetAsSystemTime(st); QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); return qdt; } class OLEListViewItem : public QCheckListItem { public: OLEListViewItem( QListView *parent, QString text ) : QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; OLEListViewItem( QListViewItem *after, QString text ) : QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; ~OLEListViewItem() {}; void setData( DWORD data ) {mData= data; }; DWORD data() { return mData ;}; private: @@ -205,97 +206,97 @@ void KOImportOLdialog::readCalendarData( DWORD folder ) dispItem->AddRef(); MAPIFolder mf(dispItem); mf.m_lpDispatch->AddRef(); _Items folderItems; _variant_t indx((long)0); LPDISPATCH itm; int i; folderItems = mf.GetItems(); QProgressBar bar( folderItems.GetCount(),0 ); bar.setCaption (i18n("Importing - close to abort!") ); int h = bar.sizeHint().height() ; int w = 300; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); bar.show(); for(i=1; i <= folderItems.GetCount(); ++i) { qApp->processEvents(); if ( ! bar.isVisible() ) return ; bar.setProgress( i ); indx = (long)i; itm = folderItems.Item(indx.Detach()); _AppointmentItem * pItem = (_AppointmentItem *)&itm; ol2kopiCalendar( pItem ); itm->Release(); } } void KOImportOLdialog::slotOk() { QDialog::accept(); } void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) { KCal::Event* event = new KCal::Event(); if ( aItem->GetAllDayEvent() ){ event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); event->setFloats( true ); } else { event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); event->setFloats( false ); } event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) ); event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) ); - event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()) ); + event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()).replace( QRegExp("\\r"), "") ); QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); event->setCategories( QStringList::split( ";", cat )); if ( aItem->GetReminderSet() ) { event->clearAlarms(); Alarm* alarm = event->newAlarm(); alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); alarm->setEnabled( true ); if ( aItem->GetReminderPlaySound() ) { alarm->setType( Alarm::Audio ); alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); } else alarm->setType( Alarm::Display ); alarm->setRepeatCount( aItem->GetReplyTime() ); } // OL :pub 0 - pers 1 - priv 2 - conf 3 // KO : pub 0 - priv 1 - conf 2 int sec = aItem->GetSensitivity() ; if ( sec > 1 )// mapping pers -> private --sec; event->setSecrecy( sec ); if ( aItem->GetBusyStatus() == 0 ) event->setTransparency( Event::Transparent);// OL free else event->setTransparency( Event::Opaque);//OL all other if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur RecurrencePattern recpat = aItem->GetRecurrencePattern(); QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); int freq = recpat.GetInterval(); bool hasEndDate = !recpat.GetNoEndDate(); QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date(); QBitArray weekDays( 7 ); weekDays.fill(false ); uint weekDaysNum = recpat.GetDayOfWeekMask(); int i; int bb = 2; for( i = 1; i <= 6; ++i ) { weekDays.setBit( i - 1, ( bb & weekDaysNum )); bb = 4 << (i-1); //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); } if ( 1 & weekDaysNum) weekDays.setBit( 6 ); // int pos = 1;// pending diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9e215b9..63484d6 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -243,115 +243,121 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : mView->setModified( false ); mBlockAtStartup = false; mView->setModified( false ); setCentralWidget( mView ); globalFlagBlockStartup = 0; mView->show(); delete splash; if ( newFile ) mView->updateConfig(); // qApp->processEvents(); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); //fillSyncMenu(); connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); mSyncManager->setDefaultFileName( defaultFileName()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); mSyncManager->fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { KMessageBox::information( this, "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"); qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //US listen for result adressed from Ka/Pi #ifndef DESKTOP_VERSION connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); #endif #ifndef DESKTOP_VERSION infrared = 0; #endif mBRdisabled = false; toggleBeamReceive(); } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location delete mCalendar; delete mSyncManager; +#ifndef DESKTOP_VERSION if ( infrared ) delete infrared; +#endif } void MainWindow::disableBR(bool b) { +#ifndef DESKTOP_VERSION if ( b ) { if ( infrared ) { toggleBeamReceive(); mBRdisabled = true; } + mBRdisabled = true; } else { if ( mBRdisabled ) { mBRdisabled = false; - toggleBeamReceive(); + //makes no sense,because other cal ap is probably running + // toggleBeamReceive(); } } +#endif } bool MainWindow::beamReceiveEnabled() { #ifndef DESKTOP_VERSION return ( infrared != 0 ); #endif return false; } void MainWindow::toggleBeamReceive() { if ( mBRdisabled ) return; #ifndef DESKTOP_VERSION if ( infrared ) { qDebug("disable BeamReceive "); delete infrared; infrared = 0; brAction->setOn(false); return; } qDebug("enable BeamReceive "); brAction->setOn(true); infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); #endif } void MainWindow::showMaximized () { #ifndef DESKTOP_VERSION if ( ! globalFlagBlockStartup ) if ( mClosed ) mView->goToday(); #endif QWidget::showMaximized () ; mClosed = false; } void MainWindow::closeEvent( QCloseEvent* ce ) { if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); mClosed = true; ce->accept(); return; |