summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-07-09 23:40:14 (UTC)
committer zautrix <zautrix>2004-07-09 23:40:14 (UTC)
commitadaa664ac87d6b78e9431d3376f7a24461edf469 (patch) (side-by-side diff)
treef82b471f0db80aa7836059441e5c3b943166ac84 /korganizer
parent5135d0b47efac71ecb7a98d7d66314c868133021 (diff)
downloadkdepimpi-adaa664ac87d6b78e9431d3376f7a24461edf469.zip
kdepimpi-adaa664ac87d6b78e9431d3376f7a24461edf469.tar.gz
kdepimpi-adaa664ac87d6b78e9431d3376f7a24461edf469.tar.bz2
Added files for OLE import on wintendo
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koimportoldialog.cpp466
-rw-r--r--korganizer/koimportoldialog.h83
-rw-r--r--korganizer/korganizer.pro23
-rw-r--r--korganizer/mainwindow.cpp22
-rw-r--r--korganizer/mainwindow.h1
5 files changed, 592 insertions, 3 deletions
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
new file mode 100644
index 0000000..36363e5
--- a/dev/null
+++ b/korganizer/koimportoldialog.cpp
@@ -0,0 +1,466 @@
+/*
+ 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 <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 "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:
+ DWORD mData;
+};
+
+KOImportOLdialog::KOImportOLdialog( const QString &caption,
+ Calendar *calendar, QWidget *parent ) :
+ KDialogBase( Plain, caption, User1 | Close, Ok,
+ parent, caption, true, false, i18n("Import!") )
+{
+ QHBox * mw = new QHBox( this );
+ setMainWidget( mw );
+ mListView = new QListView( mw );
+ mListView->addColumn(i18n("Select Folder to import"));
+ mListView->addColumn(i18n("Content Type"));
+ mCalendar = calendar;
+ connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
+ setupFolderView();
+ resize( sizeHint().width()+50, sizeHint().height()+50 );
+}
+
+KOImportOLdialog::~KOImportOLdialog()
+{
+
+}
+
+
+void KOImportOLdialog::setupFolderView()
+{
+ SCODE sc = ::OleInitialize(NULL);
+ if ( FAILED ( sc ) ) {
+ KMessageBox::information(this,"OLE initialisation failed");
+ return;
+ }
+
+ if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){
+ KMessageBox::information(this,"Sorry, cannot access Outlook");
+ return ;
+ }
+ MAPIFolder mfInbox;
+ MAPIFolder mfRoot;
+ CString szName;
+ _NameSpace olNS;
+ olNS = gOlApp.GetNamespace(_T("MAPI"));
+ mfInbox = olNS.GetDefaultFolder(6);
+ mfRoot = mfInbox.GetParent();
+ szName = mfRoot.GetName();
+ long iType = mfRoot.GetDefaultItemType();
+ QString mes;
+ mes = QString::fromUcs2( szName.GetBuffer() );
+ OLEListViewItem * root = new OLEListViewItem( mListView, mes );
+ mfRoot.m_lpDispatch->AddRef();
+ addFolder( root, mfRoot.m_lpDispatch );
+ root->setOpen( true );
+ mListView->setSortColumn( 0 );
+ mListView->sort( );
+}
+
+
+void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
+{
+ MAPIFolder mfParent(dispParent), mfChild;
+ _Folders folders;
+ _variant_t fndx((long)0);
+ CString szName;
+ long iType;
+ OLEListViewItem* hChild;
+
+ folders = mfParent.GetFolders();
+ for(int i=1; i <= folders.GetCount(); ++i)
+ {
+ fndx = (long)i;
+ mfChild = folders.Item(fndx.Detach());
+ mfChild.m_lpDispatch->AddRef();
+ szName = mfChild.GetName();
+ iType = mfChild.GetDefaultItemType();
+ hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
+ if ( iType != 1)
+ hChild->setEnabled( false );
+ QString ts;
+ switch( iType ) {
+ case 0:
+ ts = i18n("Mail");
+ break;
+ case 1:
+ ts = i18n("Calendar");
+ break;
+ case 2:
+ ts = i18n("Contacts");
+ break;
+ case 3:
+ ts = i18n("Todos");
+ break;
+ case 4:
+ ts = i18n("Journals");
+ break;
+ case 5:
+ ts = i18n("Notes");
+ break;
+ default:
+ ts = i18n("Unknown");
+ }
+ hChild->setText( 1,ts);
+ hChild->setData( (DWORD) mfChild.m_lpDispatch );
+ mfChild.m_lpDispatch->AddRef();
+ addFolder(hChild, mfChild.m_lpDispatch);
+ }
+}
+
+void KOImportOLdialog::slotApply()
+{
+ importedItems = 0;
+ OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
+ while ( child ) {
+ if ( child->isOn() )
+ readCalendarData( child->data() );
+ child = (OLEListViewItem*) child->itemBelow();
+ }
+ QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
+ KMessageBox::information(this,mes);
+}
+void KOImportOLdialog::readCalendarData( DWORD folder )
+{
+
+ LPDISPATCH dispItem = (LPDISPATCH)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()) );
+ 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
+
+ Recurrence *r = event->recurrence();
+ int rtype = recpat.GetRecurrenceType();
+ //recurrence types are:
+ /*
+ olRecursDaily(0)
+ olRecursWeekly(1)
+ olRecursMonthly(2)
+ olRecursMonthNth(3)
+ olRecursYearly(5)
+ olRecursYearNth(6)
+ */
+
+ int duration = recpat.GetOccurrences();
+ if ( !hasEndDate )
+ duration = -1;
+
+ //LPDISPATCH RecurrencePattern::GetExceptions()
+ //long RecurrencePattern::GetMonthOfYear()
+ if ( rtype == 0 ) {
+ if ( hasEndDate ) r->setDaily( freq, endDate );
+ else r->setDaily( freq, duration );
+ } else if ( rtype == 1 ) {
+ if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
+ else r->setWeekly( freq, weekDays, duration );
+ } else if ( rtype == 2 ) {
+ if ( hasEndDate )
+ r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
+ else
+ r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
+ //r->addMonthlyDay( startDate.day() );
+ r->addMonthlyDay( recpat.GetDayOfMonth() );
+ } else if ( rtype == 3 ) {
+ if ( hasEndDate )
+ r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
+ else
+ r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
+ QBitArray days( 7 );
+ days.fill( false );
+ days.setBit( startDate.dayOfWeek() - 1 );
+ int pos = (startDate.day()/7)+1;
+ r->addMonthlyPos( pos, days );
+ //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1);
+ //KMessageBox::information(this,mes);
+ } else if ( rtype == 5 ) {
+ freq = 1;
+ if ( hasEndDate )
+ r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
+ else
+ r->setYearly( Recurrence::rYearlyMonth, freq, duration );
+ r->addYearlyNum( startDate.month() );
+ } else if ( true /*rtype == 6*/ ) {
+ // KOganizer cannot handle this in the GUI
+ // we are mapping this to monthly - every 12. month
+ freq = 12;
+ if ( hasEndDate )
+ r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
+ else
+ r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
+ QBitArray days( 7 );
+ days.fill( false );
+ days.setBit( startDate.dayOfWeek() - 1 );
+ int pos = (startDate.day()/7)+1;
+ r->addMonthlyPos( pos, days );
+ }
+ // recurrence exceptions
+ LPDISPATCH dispItem = recpat.GetExceptions();
+ dispItem->AddRef();
+ Exceptions ex(dispItem);
+ _variant_t indx((long)0);
+ LPDISPATCH itm;
+ for(i=1; i <= ex.GetCount(); ++i) {
+ indx = (long)i;
+ itm = ex.Item( indx.Detach() );
+ ::Exception * pItem = (::Exception *)&itm;
+ event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() );
+ if ( !pItem->GetDeleted() ) {
+ LPDISPATCH appIt = pItem->GetAppointmentItem();
+ _AppointmentItem * paItem = (_AppointmentItem *)&appIt;
+ ol2kopiCalendar( paItem, false );
+ }
+ itm->Release();
+ }
+ }
+ // recurrence ENTE
+ event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer()));
+
+ //GetOptionalAttendees()
+ //GetRequiredAttendees()
+ LPDISPATCH dispItem = aItem->GetRecipients();
+ dispItem->AddRef();
+ _Folders mf(dispItem);
+ mf.m_lpDispatch->AddRef();
+ _variant_t indx((long)0);
+ LPDISPATCH itm;
+ int i;
+ QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer());
+ QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer());
+ //GetRequiredAttendees()
+ for(i=1; i <= mf.GetCount(); ++i) {
+ indx = (long)i;
+ itm = mf.Item( indx.Detach() );
+ Recipient * pItem = (Recipient *)&itm;
+
+ //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
+ QString name = QString::fromUcs2( pItem->GetName().GetBuffer());
+ KCal::Attendee::PartStat stat;
+ bool rsvp = false;
+ switch ( pItem->GetMeetingResponseStatus() ) {
+ case 0: //not answered
+ rsvp = true;
+ case 5: //not answered
+ stat = Attendee::NeedsAction;
+ break;
+ case 1: //organizer
+ stat = Attendee::Delegated ;
+ break;
+ case 2: //tentative
+ stat = Attendee::Tentative ;
+ break;
+ case 3: //accepted
+ stat = Attendee::Accepted;
+ break;
+ case 4: //declined
+ stat =Attendee::Declined ;
+ break;
+ default:
+ stat = Attendee::NeedsAction ;
+
+ }
+ KCal::Attendee::Role role;
+ if ( event->organizer() == name )
+ role = KCal::Attendee::Chair;
+ else if ( reqAtt.find( name ) >= 0 )
+ role = KCal::Attendee::ReqParticipant;
+ else if ( optAtt.find( name ) >= 0 )
+ role = KCal::Attendee::OptParticipant;
+ else
+ role = KCal::Attendee::NonParticipant;
+ QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
+ if( mail.isEmpty() && name.find("@") > 0 )
+ mail = name;
+ QString uid;
+ if ( mail.isEmpty() )
+ uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
+ else
+ uid = mail;
+ mail = mail.stripWhiteSpace();
+ KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ;
+ event->addAttendee( a , false );
+ itm->Release();
+ }
+
+
+ if ( !mCalendar->addEventNoDup( event ))
+ delete event;
+ else {
+ // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString());
+ //KMessageBox::information(this,mes);
+ ++importedItems;
+ }
+}
+void KOImportOLdialog::slotCancel()
+{
+ reject();
+}
diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h
new file mode 100644
index 0000000..f6a753d
--- a/dev/null
+++ b/korganizer/koimportoldialog.h
@@ -0,0 +1,83 @@
+/*
+ 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.
+*/
+#ifndef KOINCIDENCEEDITOR_H
+#define KOINCIDENCEEDITOR_H
+
+#include <kdialogbase.h>
+
+#include <afxdisp.h>
+#include <libkcal/calendar.h>
+#include <libkcal/event.h>
+
+
+class QDateTime;
+class QListView;
+class OLEListViewItem;
+class _AppointmentItem;
+namespace KPIM { class CategorySelectDialog; }
+
+using namespace KCal;
+
+/**
+ This is the base class for the calendar component editors.
+*/
+class KOImportOLdialog : public KDialogBase
+{
+ Q_OBJECT
+ public:
+ /**
+ Construct new IncidenceEditor.
+ */
+ KOImportOLdialog( const QString &caption, Calendar *calendar,
+ QWidget *parent );
+ virtual ~KOImportOLdialog();
+
+ /** Initialize editor. This function creates the tab widgets. */
+ void init();
+
+ public slots:
+
+
+ signals:
+
+ protected slots:
+ void slotApply();
+ void slotOk();
+ void slotCancel();
+
+ protected:
+ void setupFolderView();
+ void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
+ void readCalendarData( DWORD folder );
+ void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true );
+
+ Calendar *mCalendar;
+ QListView * mListView;
+
+ private:
+ int importedItems;
+};
+
+#endif
+
+
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index fe2250e..4e8ce11 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,172 +1,191 @@
TEMPLATE = app
CONFIG = qt warn_on
TARGET = kopi
OBJECTS_DIR = _obj/
MOC_DIR = _moc
DESTDIR= ../bin
include( ../variables.pri )
INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile
#../qtcompat
DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
#KORG_NOPRINTER KORG_NOKABC
DEFINES += KORG_NOLVALTERNATION
DEFINES += DESKTOP_VERSION
unix : {
LIBS += ../bin/libmicrokdepim.so
LIBS += ../bin/libmicrokcal.so
LIBS += ../bin/libmicrokde.so
LIBS += ../bin/libmicrokabc.so
LIBS += -lldap
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
-DEFINES += _WIN32_
+DEFINES += _WIN32_
LIBS += ../bin/microkdepim.lib
LIBS += ../bin/microkcal.lib
LIBS += ../bin/microkde.lib
LIBS += ../bin/microkabc.lib
LIBS += ../libical/lib/ical.lib
LIBS += ../libical/lib/icalss.lib
+#LIBS += atls.lib
+LIBS += mfc71u.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
+#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
+#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = kofilterview_base.ui
# filteredit_base.ui
# kdateedit.h \
HEADERS = \
filteredit_base.h \
alarmclient.h \
calendarview.h \
customlistviewitem.h \
datenavigator.h \
docprefs.h \
filtereditdialog.h \
incomingdialog.h \
incomingdialog_base.h \
interfaces/korganizer/baseview.h \
interfaces/korganizer/calendarviewbase.h \
journalentry.h \
kdatenavigator.h \
koagenda.h \
koagendaitem.h \
koagendaview.h \
kocounterdialog.h \
kodaymatrix.h \
kodialogmanager.h \
koeditordetails.h \
koeditorgeneral.h \
koeditorgeneralevent.h \
koeditorgeneraltodo.h \
koeditorrecurrence.h \
koeventeditor.h \
koeventpopupmenu.h \
koeventview.h \
koeventviewer.h \
koeventviewerdialog.h \
kofilterview.h \
koglobals.h \
koincidenceeditor.h \
kojournalview.h \
kolistview.h \
kolocationbox.h \
komonthview.h \
koprefs.h \
koprefsdialog.h \
kosyncprefsdialog.h \
kotimespanview.h \
kotodoeditor.h \
kotodoview.h \
kotodoviewitem.h \
koviewmanager.h \
kowhatsnextview.h \
ktimeedit.h \
lineview.h \
mainwindow.h \
navigatorbar.h \
outgoingdialog.h \
outgoingdialog_base.h \
publishdialog.h \
publishdialog_base.h \
savetemplatedialog.h \
searchdialog.h \
simplealarmclient.h \
statusdialog.h \
timeline.h \
timespanview.h \
version.h \
- ../kalarmd/alarmdialog.h
+ ../kalarmd/alarmdialog.h \
+
SOURCES = \
filteredit_base.cpp \
calendarview.cpp \
datenavigator.cpp \
docprefs.cpp \
filtereditdialog.cpp \
incomingdialog.cpp \
incomingdialog_base.cpp \
journalentry.cpp \
kdatenavigator.cpp \
koagenda.cpp \
koagendaitem.cpp \
koagendaview.cpp \
kocounterdialog.cpp \
kodaymatrix.cpp \
kodialogmanager.cpp \
koeditordetails.cpp \
koeditorgeneral.cpp \
koeditorgeneralevent.cpp \
koeditorgeneraltodo.cpp \
koeditorrecurrence.cpp \
koeventeditor.cpp \
koeventpopupmenu.cpp \
koeventview.cpp \
koeventviewer.cpp \
koeventviewerdialog.cpp \
kofilterview.cpp \
koglobals.cpp \
koincidenceeditor.cpp \
kojournalview.cpp \
kolistview.cpp \
kolocationbox.cpp \
komonthview.cpp \
koprefs.cpp \
koprefsdialog.cpp \
kosyncprefsdialog.cpp \
kotimespanview.cpp \
kotodoeditor.cpp \
kotodoview.cpp \
kotodoviewitem.cpp \
koviewmanager.cpp \
kowhatsnextview.cpp \
ktimeedit.cpp \
lineview.cpp \
main.cpp \
mainwindow.cpp \
navigatorbar.cpp \
outgoingdialog.cpp \
outgoingdialog_base.cpp \
publishdialog.cpp \
publishdialog_base.cpp \
savetemplatedialog.cpp \
searchdialog.cpp \
simplealarmclient.cpp \
statusdialog.cpp \
timeline.cpp \
timespanview.cpp \
../kalarmd/alarmdialog.cpp
HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
INTERFACES += calprintdayconfig_base.ui \
calprintmonthconfig_base.ui \
calprinttodoconfig_base.ui \
calprintweekconfig_base.ui
SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
+
+
+
+win32: {
+HEADERS += ../outport/msoutl9.h \
+ koimportoldialog.h
+
+
+SOURCES += ../outport/msoutl9.cpp \
+ koimportoldialog.cpp
+
+
+}
+
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 40f2cf4..be69be7 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -4,100 +4,101 @@
#include <qpopupmenu.h>
#include <qpainter.h>
#include <qwhatsthis.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qfile.h>
#include <qdir.h>
#include <qapp.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qwmatrix.h>
#include <qtextbrowser.h>
#include <qtextstream.h>
#ifndef DESKTOP_VERSION
#include <qpe/global.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qtopia/alarmserver.h>
#include <qtopia/qcopenvelope_qws.h>
#else
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qapplication.h>
//#include <resource.h>
#endif
#include <libkcal/calendarlocal.h>
#include <libkcal/todo.h>
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/kincidenceformatter.h>
#include "calendarview.h"
#include "koviewmanager.h"
#include "datenavigator.h"
#include "koagendaview.h"
#include "koagenda.h"
#include "kodialogmanager.h"
#include "kdialogbase.h"
#include "kstandarddirs.h"
#include "koprefs.h"
#include "kfiledialog.h"
#include "koglobals.h"
#include "kglobal.h"
#include "klocale.h"
#include "kconfig.h"
#include "simplealarmclient.h"
-
using namespace KCal;
#ifndef _WIN32_
#include <unistd.h>
+#else
+#include "koimportoldialog.h"
#endif
#include "mainwindow.h"
int globalFlagBlockStartup;
MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
QMainWindow( parent, name )
{
#ifdef DESKTOP_VERSION
setFont( QFont("Arial"), 14 );
#endif
//QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
QString confFile = locateLocal("config","korganizerrc");
QFileInfo finf ( confFile );
bool showWarning = !finf.exists();
setIcon(SmallIcon( "ko24" ) );
mBlockAtStartup = true;
mFlagKeyPressed = false;
setCaption("KOrganizer/Pi");
KOPrefs *p = KOPrefs::instance();
// if ( QApplication::desktop()->height() > 480 ) {
// if ( p->mHourSize == 4 )
// p->mHourSize = 6;
// }
if ( p->mHourSize > 18 )
p->mHourSize = 18;
QMainWindow::ToolBarDock tbd;
if ( p->mToolBarHor ) {
if ( p->mToolBarUp )
tbd = Bottom;
else
tbd = Top;
}
else {
if ( p->mToolBarUp )
tbd = Right;
else
tbd = Left;
}
if ( KOPrefs::instance()->mUseAppColors )
QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
globalFlagBlockStartup = 1;
iconToolBar = new QPEToolBar( this );
addToolBar (iconToolBar , tbd );
mBlockSaveFlag = false;
mCalendarModifiedFlag = false;
@@ -539,96 +540,104 @@ void MainWindow::initActions()
mView, SLOT( deleteIncidence() ) );
actionMenu->insertSeparator();
action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
icon = loadPixmap( pathString + "search" );
QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
search_action->addTo( actionMenu );
connect( search_action, SIGNAL( activated() ),
mView->dialogManager(), SLOT( showSearchDialog() ) );
icon = loadPixmap( pathString + "today" );
configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
today_action->addTo( actionMenu );
connect( today_action, SIGNAL( activated() ),
mView, SLOT( goToday() ) );
if ( KOPrefs::instance()->mShowFullMenu ) {
actionMenu->insertSeparator();
actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
}
// actionMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
action = new QAction( "import_quick", i18n("Import last file"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
importMenu->insertSeparator();
action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
#ifndef DESKTOP_VERSION
importMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
+#else
+#ifdef _WIN32_
+ importMenu->insertSeparator();
+ action = new QAction( "import_ol", i18n("Import from OL"), 0,
+ this );
+ action->addTo( importMenu );
+ connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
+#endif
#endif
importMenu->insertSeparator();
action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
importMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
this );
action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
importMenu->insertSeparator();
action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
#ifndef DESKTOP_VERSION
importMenu->insertSeparator();
action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
#else
importMenu->insertSeparator();
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( printCal() ) );
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( printSel() ) );
#endif
importMenu->insertSeparator();
@@ -885,97 +894,99 @@ int MainWindow::ringSync()
#endif
}
}
}
delete temp;
return syncedProfiles;
}
void MainWindow::multiSync( bool askforPrefs )
{
if (mBlockSaveFlag)
return;
mBlockSaveFlag = true;
QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
question,
i18n("Yes"), i18n("No"),
0, 0 ) != 0 ) {
mBlockSaveFlag = false;
setCaption(i18n("Aborted! Nothing synced!"));
return;
}
mView->setSyncDevice(i18n("Multiple profiles") );
KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
mView->edit_sync_options();
KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
}
setCaption(i18n("Multiple sync started.") );
qApp->processEvents();
int num = ringSync() ;
if ( num > 1 )
ringSync();
mBlockSaveFlag = false;
if ( num )
save();
if ( num )
setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
else
setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
return;
}
void MainWindow::slotSyncMenu( int action )
{
//qDebug("syncaction %d ", action);
if ( action == 0 ) {
+
confSync();
+
return;
}
if ( action == 1 ) {
multiSync( true );
return;
}
if (mBlockSaveFlag)
return;
mBlockSaveFlag = true;
mCurrentSyncProfile = action - 1000 ;
mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
KConfig *config = KOGlobals::config();
KSyncProfile* temp = new KSyncProfile ();
temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
temp->readConfig(config);
KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
if ( action == 1000 ) {
syncSharp();
} else if ( action == 1001 ) {
syncLocalFile();
} else if ( action == 1002 ) {
quickSyncLocalFile();
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
if ( syncWithFile( temp->getRemoteFileName( ), false ) )
KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
} else {
syncRemote( temp );
}
}
delete temp;
mBlockSaveFlag = false;
}
void MainWindow::setDefaultPreferences()
{
KOPrefs *p = KOPrefs::instance();
p->mCompactDialogs = true;
@@ -1174,96 +1185,105 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
startString += " --- "+((Event*)incidence)->dtEndStr(true);
}
} else {
if ( incidence->dtStart().time() != incidence->dtEnd().time() )
startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
"-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
}
}
else
startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
if ( !incidence->location().isEmpty() )
startString += " (" +incidence->location()+")";
setCaption( incidence->summary()+startString);
enableIncidenceActions( true );
if ( incidence->type() == "Event" ) {
mShowAction->setText( i18n("Show Event...") );
mEditAction->setText( i18n("Edit Event...") );
mDeleteAction->setText( i18n("Delete Event...") );
mNewSubTodoAction->setEnabled( false );
} else if ( incidence->type() == "Todo" ) {
mShowAction->setText( i18n("Show Todo...") );
mEditAction->setText( i18n("Edit Todo...") );
mDeleteAction->setText( i18n("Delete Todo...") );
mNewSubTodoAction->setEnabled( true );
} else {
mShowAction->setText( i18n("Show...") );
mShowAction->setText( i18n("Edit...") );
mShowAction->setText( i18n("Delete...") );
mNewSubTodoAction->setEnabled( false );
}
}
void MainWindow::enableIncidenceActions( bool enabled )
{
mShowAction->setEnabled( enabled );
mEditAction->setEnabled( enabled );
mDeleteAction->setEnabled( enabled );
}
+void MainWindow::importOL()
+{
+#ifdef _WIN32_
+ KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
+ id->exec();
+ delete id;
+ mView->updateView();
+#endif
+}
void MainWindow::importBday()
{
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
i18n("Import!"), i18n("Cancel"), 0,
0, 1 );
if ( result == 0 ) {
mView->importBday();
}
}
void MainWindow::importQtopia()
{
#ifndef DESKTOP_VERSION
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
i18n("Import!"), i18n("Cancel"), 0,
0, 1 );
if ( result == 0 ) {
QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
mView->importQtopia( categories, datebook, todolist );
}
#else
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("Not supported \non desktop!\n"),
i18n("Ok"), i18n("Cancel"), 0,
0, 1 );
#endif
}
void MainWindow::saveOnClose()
{
KOPrefs *p = KOPrefs::instance();
p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
p->mToolBarUp = iconToolBar->x() > width()/2 ||
iconToolBar->y() > height()/2;
mView->writeSettings();
if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
save();
}
void MainWindow::slotModifiedChanged( bool changed )
{
if ( mBlockAtStartup )
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index ee4aaa6..a681f42 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -8,96 +8,97 @@
#include <libkcal/incidence.h>
#include "simplealarmclient.h"
class QAction;
class CalendarView;
class KSyncProfile;
#ifdef DESKTOP_VERSION
#define QPEToolBar QToolBar
#define QPEMenuBar QMenuBar
#endif
class QPEToolBar;
namespace KCal {
class CalendarLocal;
}
using namespace KCal;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
~MainWindow();
public slots:
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
static QString defaultFileName();
static QString resourcePath();
protected slots:
void setCaptionToDates();
int ringSync();
void multiSync( bool askforPrefs = false );
void about();
void faq();
void usertrans();
void features();
void synchowto();
void whatsNew();
void keyBindings();
void aboutAutoSaving();;
void aboutKnownBugs();
void processIncidenceSelection( Incidence * );
void importQtopia();
void importBday();
+ void importOL();
void importIcal();
void importFile( QString, bool );
void quickImportIcal();
void slotModifiedChanged( bool );
void save();
void configureToolBar( int );
void printSel();
void printCal();
void saveCalendar();
void loadCalendar();
void exportVCalendar();
void slotSyncMenu( int );
void syncSSH();
void confSync();
void syncSharp();
void syncLocalFile();
bool syncWithFile( QString, bool );
void quickSyncLocalFile();
protected:
void displayText( QString, QString);
void displayFile( QString, QString);
void enableIncidenceActions( bool );
private:
void saveOnClose();
int mCurrentSyncProfile;
void syncRemote( KSyncProfile* , bool ask = true);
void fillSyncMenu();
bool mFlagKeyPressed;
bool mBlockAtStartup;
QPEToolBar *iconToolBar;
void initActions();
void setDefaultPreferences();
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
QPopupMenu *configureToolBarMenu;
QPopupMenu *configureAgendaMenu, *syncMenu;
CalendarLocal *mCalendar;
CalendarView *mView;
QString getPassword();
QAction *mNewSubTodoAction;