-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 2 | ||||
-rw-r--r-- | kaddressbook/kaimportoldialog.cpp | 7 | ||||
-rw-r--r-- | korganizer/koimportoldialog.cpp | 8 |
3 files changed, 10 insertions, 7 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 792cb91..5e2180f 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -734,193 +734,193 @@ { "Tentative","Vorläufig" }, { "Delegated","Beauftragt" }, { "Completed","Vollständig" }, { "In Process","In Bearbeitung" }, { "Participant","Teilnehmer" }, { "Optional Participant","Möglicher Teilnehmer" }, { "Observer","Beobachter" }, { "Chair","Vorsitzender" }, { "Not supported \non desktop!\n","" }, { "Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. ","Es ist nichts selektiert!\nDieses druckt die volle Breite der Agenda View, so wie man sie sieht.\nUm die vertikale Auswahl zum Drucken zu bestimmen,\nbitte einen vertikalen Zeitraum (mit gedrückter linker Maustaste)\nin einer Spalte auswählen.\n(Es wird danach direkt der Termin Dialog angezeigt\n - dort bitte auf Abbrechen klicken) " }, { "Date range: ","Datums Zeitspanne: " }, { "Not supported \non PDA!\n","Nicht verfügbar\nauf dem PDA. " }, { "Syncing - close to abort!","Syncing-schließe um abzubrechen." }, { "Add / remove events","Add./entferne Termine" }, { "File does not exist:\n '%1'.","Datei existiert nicht:\n '%1'." }, { "Couldn't load calendar\n '%1'.","Kann Kalender nicht laden:\n '%1'." }, { "\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n","\nDie gepeicherte Datei wurde verändert!\nDatei Grösse: %1 Bytes.\nZuletzt geändert: %2\nMöchten Sie:\n\n - Speichern und die Datei überschreiben?\n - Mit Datei Synchronisieren, dann speichern?\n - Abbrechen ohne zu speichern? \n" }, { "Overwrite","Überschreiben" }, { "Sync+save","Syncen+speichern" }, { "Default","Standard" }, { " Categories added to list! "," Kategorien zur Liste hinzugefügt! " }, { " %d items?"," %d Einträge?" }, { "\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?","\nDieses ist ein\nwiederholender Termin!.\nSind Sie sicher, dass Sie\ndiesen Termin und alle\nWiederholungen löschen möchten?" }, { " ?\n\nDelete:\n"," ?\n\nLösche:\n" }, { "Current","Aktuelle" }, { "\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n","\nDieses ist ein\nwiederholender Termin!\nMöchten sie alle Wiederholungen\nlöschen, oder nur die aktuelle am:\n" }, { "All","Alle" }, { "Data Loss Warning","Datenverlust Warnung" }, { "Proceed","Weitermachen" }, { "The journal entries can not be\nexported to a vCalendar file.","Die Journal Einträge können\nnicht in eine vCalendar\nDatei exportiert werden!" }, { "Filter disabled ","Filter abgeschaltet" }, { "Filter selected: ","Gewählter Filter: " }, { "Toggle Cancel","Gecancelt ändern" }, { "&Toggle Cancel","Gecancel&t ändern" }, { "Configure Toolbar","Konfiguriere Toolbar" }, { "Stretched TB","Gedehnte TB" }, { "Import file \n...%1\ndoes not exist!\nNothing imported!\n","Import Datei \n...%1\nexistiert nicht!\nNichts importiert!\n" }, { "Import filename(*.ics/*.vcs)","Import Dateiname(*.ics/*.vcs)" }, { "When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing","Wenn ein Kalender doppelt importiert\nwird, werden doppelte Einträge ignoriert!\nSie können eine Backup Datei anlegen unter\nDatei - Speichere Kalender Backup\num den Import rückgängig machen zu können.\n" }, { "Not supported \non desktop!\n","Nur verfügbar auf PDA!" }, { "Imported file successfully","Datei erfolgreich importiert" }, { "Error importing file","Fehler beim Importieren der Datei" }, { "Export vcal filename(*.vcs)","Export vcal Dateiname(*.vcs)" }, { "Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n","Zu speichernde Datei\existiert bereits!\nExist. Datei vom:\n%1\nÜberschreiben?\n" }, { "Overwrite!","Überschreiben!" }, { "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n","Import Datei \n...%1\nvom:\n%2\nDuplizierte Einträge\nwerden nicht importiert!\n" }, { "Load backup filename","Lade Backup Dateiname" }, { "Backup file\ndoes not exist!\nNothing loaded!","Backup Datei\nexistiert nicht!\nNichts geladen!" }, { "KO/Pi:Loaded %1","KO/Pi:Geladen %1" }, { "Save backup filename","Speichere Backup Dateiname" }, { "Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n","Backup Datei\nexistiert bereits!\nAlte Backup Datei vom:\n%1\nÜberschreiben?\n" }, { "KO/Pi:Saved %1","KO/Pi:Gespeichert %1" }, { "Details of attendee","Teilnehmerdetails" }, { "Work phone:\n","Telefon Arbeit:\n" }, { "Work mobile phone:\n","Mobiltelefon Arbeit:\n" }, { "Home phone:\n","Telefon privat:\n" }, { "Mobile home phone:\n","Mobiltelefon privat:\n" }, { "Email:\n","Email:\n" }, { "Alarm disabled for this item","Alarm deaktiviert für dieses Item" }, { "Audio Al.: ","Audio Al.: " }, { "Proc.Al.: ","Proz.Al.: " }, { "No sound set","Kein Sound definiert" }, { "*.wav|Wav Files","*.wav|Wav Dateien" }, { "No program set","Kein Programm definiert" }, { "Running '%1'","Ausführen '%1'" }, { "Playing '%1'","Abspielen '%1'" }, { "User defined (usertranslation.txt)","Benutzerdefiniert (usertranslation.txt)" }, { "Load!","Laden!" }, { "Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n","Backup Datei vom:\n%1\nDas Laden der Backup Datei\nlöscht die aktuellen Daten!\n" }, { "KO/Pi Features and hints","KO/Pi Eigenschaften und Tipps" }, { "KO/Pi User translation HowTo","KO/Pi Benutzer-Übersetzung HowTo" }, { "KO/Pi Synchronization HowTo","KO/Pi Synchronisation HowTo" }, { "Features + hints...","Eigenschaften + Tipps..." }, { "User translation...","Benutzer Übersetzung..." }, { "Sync HowTo...","Synchronisation HowTo..." }, { "Print calendar...","Drucke Kalender..." }, { "Anniversary","Jahrestag" }, { "When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n","Wenn Geburtstage mehrfach importiert\nwerden, werden doppelte Einträge ignoriert\nwenn sie nicht verändert wurden.\n" }, { "Import Birthdays (KA/Pi)","Importiere Geburtstage (KA/Pi)" }, { "Next recurrence is on: ","Nächste Wiederholung ist am:" }, { "<b>Alarm on: </b>","<b>Alarm am: </b>" }, { "<b>Access: </b>","<b>Zugriff: </b>" }, { "(%1 min before)","(%1 min vorher)" }, { "<b>Categories: </b>","<b>Kategorien: </b>" }, { "Save Journal/Description...","Speichere Journal/Details..." }, { "This saves the text/details of selected\nJournals and Events/Todos\nto a text file.","Das speichert den Text bzw.\ndie Details von selektierten\nJournalen und Events/Todos\nin eine Textdatei." }, { "Continue","Weitermachen" }, { " birthdays/anniversaries added!"," Geburts-/Jahrestage hinzugefügt" }, { "Attendee:","Teilnehmer:" }, { "Click OK to search ->","Klicke zum Suchen auf OK ->" }, { "On day ","Am Tag " }, { "%1 of ","%1 des Monats" }, { "%1 of the year","%1 des Jahres" }, { "Anonymous","Anonymo" }, { "nobody@nowhere","niemand@nirgendwo" }, { "calendar.html","calendar.html" }, -{ " Local Time"," Locale Zeit" }, +{ " Local Time"," Lokale Zeit" }, { "Unknown Name","Unbekannter Name" }, { "unknown@nowhere","unbekannt@nirgendwo" }, { "Beam via IR!","Beam via IR!" }, { "Next Month","Nächster Monat" }, { "Prio","Prio" }, { "Reparent Todo","Mache Sub-Todo" }, { "tomorrow","morgen" }, { "today","heute" }, { "yesterday","gestern" }, { "Ok","Ok" }, { "Ok+Agenda","Ok+Agenda" }, { "Email","Email" }, { "RSVP","RSVP" }, { "Email:","Email:" }, { "Appointment Time ","Termin Zeit " }, { "2","2" }, { "3","3" }, { "4","4" }, { " 0 %"," 0 %" }, { " 20 %"," 20 %" }, { " 40 %"," 40 %" }, { " 60 %"," 60 %" }, { " 80 %"," 80 %" }, { "100 %","100 %" }, { "Filter","Filter" }, { "Configure","Konfiguriere" }, { "What's Next","What's Next" }, { "Complete calendar...","Kompletten Kalender..." }, { "Filtered calendar...","Gefilterten Kalender..." }, { "Export to phone","Exportiere zum Handy" }, { "Beam receive enabled","Beam Empfang an" }, { "What's new?","Was ist neu?" }, { "FAQ...","FAQ..." }, { "Licence...","Licence..." }, { "What's This?","What's This?" }, { "&Edit...","&Editiere..." }, { "Oktober","Oktober" }, { "Title","Titel" }, { "%1 %","%1 %" }, { "Enable Pi-Sync","Schalte Pi-Sync an" }, { "Import!","Importiere!" }, { "inserting birthdays - close to abort!","Burzeltage werden eingefügt - schließe um abzubrechen!" }, { "Export to phone options","Export ans Handy Optionen" }, { "Please read Help-Sync Howto\nto know what settings to use.","Bitte lese Hilfe-Sync Howto\num zu erfahren welche Einstellungen\ndie richtigen sind." }, { "I/O device: ","I/O device: " }, { "Connection: ","Connection: " }, { "Model(opt.): ","Model(opt.): " }, { "Write back events in future only","Schreibe nur zukünftige Termine zurück" }, { "Max. weeks in future: ","Max. Wochen in der Zukunft: " }, { "NOTE: This will remove all old\ntodo/calendar data on phone!","ACHTUNG: Das löscht alle alten\nTodo/Kalender Daten auf dem Handy!" }, { "Export to mobile phone!","Exportiere auf das Handy!" }, { "Export complete calendar","Exportiere kompletten Kalender" }, { "Writing to phone...","Sende Daten ans Handy..." }, { " This may take 1-3 minutes!"," Das kann 1-3 Minuten dauern!" }, { "Retry","Nochmal versuchen" }, { "KDE/Pim phone access","KDE/Pim Handy Zugriff" }, { "Error accessing device!\nPlease turn on connection\nand retry!","Fehler beim Zugriff auf das Gerät!\nBitte die Verbindung aktivieren\nund nochmal versuchen!" }, { "Error exporting to phone!","Fehler beim Export auf das Handy!" }, { "Export filtered calendar","Exportiere gefilterten Kalender" }, { "Preferences","Vorlieben" }, { "Global","Global" }, { "Phone","Phone" }, { "SMS","SMS" }, { "Fax","Fax" }, { "Pager","Pager" }, { "SIP","SIP" }, { "Italian","Italienisch" }, { "24:00","24:00" }, { "12:00am","12:00am" }, { "24.03.2004 (%d.%m.%Y|%A %d %B %Y)","24.03.2004 (%d.%m.%Y|%A %d %B %Y)" }, { "03.24.2004 (%m.%d.%Y|%A %B %d %Y)","03.24.2004 (%m.%d.%Y|%A %B %d %Y)" }, { "2004-03-24 (%Y-%m-%d|%A %Y %B %d)","2004-03-24 (%Y-%m-%d|%A %Y %B %d)" }, { "Mon 19.04.04: %a %d.%m.%y","Mon 19.04.04: %a %d.%m.%y" }, { "Mon, 19.Apr.04: %a, %d.%b.%y","Mon, 19.Apr.04: %a, %d.%b.%y" }, { "Add 30 min to selected Timezone","Addiere 30 min zur Zeitzone" }, { "Used Mail Client","Benutzter Mail Client" }, { "Channel:","Channel:" }, { "Message:","Message:" }, { "Parameters:","Parameter:" }, { "HINT: Delimiter=; Name=%1,Email=%2","Hinweis: Begrenzer=; Name=%1,Email=%2" }, { "extra Message:","extra Message:" }, { "extra Parameters:","extra Parameter:" }, { "HINT: Emails=%1,Attachments=%2","Hinweis: Emails=%1,Attachments=%2" }, { "External Apps.","Externe Appl." }, { "24 hours","24 Std." }, { "3 hours","3 Std." }, { "1 hour","1 Std." }, { "15 minutes","15 Min." }, { "5 minutes","5 Min." }, { "1 minute","1 Min." }, { "23","23" }, { "Mon 15","Mon 15" }, { "Configure KO","Konfiguriere KO" }, { "Event text","Termin Text" }, { "ToDo","Todo" }, { "Today","Heute" }, diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp index 7bb8bd8..2f794d6 100644 --- a/kaddressbook/kaimportoldialog.cpp +++ b/kaddressbook/kaimportoldialog.cpp @@ -1,323 +1,324 @@ /* This file is part of KAddressbook/Pi. Copyright (c) 2004 Lutz Rogowski <rogowski@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 <qprogressdialog.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qdir.h> #include <qregexp.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 <kabc/addresseelist.h> #include <kabc/phonenumber.h> #include "kaimportoldialog.h" #include "../outport/msoutl9.h" #include <ole2.h> #include <comutil.h> _Application gOlAppAB; QDateTime mDdate2Qdtr( DATE dt) { COleDateTime odt; SYSTEMTIME st; odt = dt; if ( odt.GetStatus() != 0 ) return QDateTime(); odt.GetAsSystemTime(st); if ( st.wYear > 4000 ) // this program as a year 4000 bug! return QDateTime(); // it seems so, that 1.1.4501 indicates: DATE invalid 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; }; KAImportOLdialog::KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook, 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")); mABook = aBook; connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); setupFolderView(); resize( sizeHint().width()+50, sizeHint().height()+50 ); } KAImportOLdialog::~KAImportOLdialog() { } KABC::Addressee::List KAImportOLdialog::getAddressList() { return mAList; } void KAImportOLdialog::setupFolderView() { SCODE sc = ::OleInitialize(NULL); if ( FAILED ( sc ) ) { KMessageBox::information(this,"OLE initialisation failed"); return; } if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ KMessageBox::information(this,"Sorry, cannot access Outlook"); return ; } MAPIFolder mfInbox; MAPIFolder mfRoot; CString szName; _NameSpace olNS; olNS = gOlAppAB.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 KAImportOLdialog::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 != 2) 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 KAImportOLdialog::slotApply() { importedItems = 0; OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); while ( child ) { if ( child->isOn() ) readContactData( child->data() ); child = (OLEListViewItem*) child->itemBelow(); } QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); KMessageBox::information(this,mes); } void KAImportOLdialog::readContactData( 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!") ); + QProgressDialog bar( i18n("Importing contact data"),i18n("Abort"), folderItems.GetCount(),this); + bar.setCaption (i18n("Importing!") ); 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.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()); _ContactItem * pItem = (_ContactItem *)&itm; ol2kapiContact( pItem ); itm->Release(); } } void KAImportOLdialog::slotOk() { QDialog::accept(); } void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) { KABC::Addressee addressee; addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); //GetLastModificationTime() //addressee.setName( const QString &name ); //addressee.setFormattedName( const QString &formattedName ); addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); if ( dtb.isValid() ) addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); //QString::fromUcs2(aItem->.GetBuffer()) //addressee.setMailer( const QString &mailer ); //addressee.setTimeZone( const TimeZone &timeZone ); //addressee.setGeo( const Geo &geo ); //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") ); QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); notesStr.replace( QRegExp("\\r"), ""); addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); //addressee.setRevision( const QDateTime &revision ); // addressee.setSortString( const QString &sortString ); addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); QString tempS; tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); if ( tempS.length() > 12 ) addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()).replace( QRegExp("\\r"), ""); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); if ( !tempS.isEmpty() ) addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); dtb = mDdate2Qdtr(aItem->GetAnniversary()); if (dtb.isValid() ) { QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); } int sec = aItem->GetSensitivity() ; if ( sec > 1 )// mapping pers -> private --sec; addressee.setSecrecy( sec ); //addressee.setLogo( const Picture &logo ); //addressee.setPhoto( const Picture &photo ); //addressee.setSound( const Sound &sound ); //addressee.setAgent( const Agent &agent ); QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("\\r"), ""); cat = cat.replace( QRegExp("; "), ";"); addressee.setCategories( QStringList::split( ";", cat )); QString phoneS; phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); if ( ! phoneS.isEmpty()) addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp index 7aa6076..2af436c 100644 --- a/korganizer/koimportoldialog.cpp +++ b/korganizer/koimportoldialog.cpp @@ -1,323 +1,325 @@ /* 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 <qprogressdialog.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 ) { mData = 0; }; OLEListViewItem( QListViewItem *after, QString text ) : QCheckListItem( after, text, QCheckListItem::CheckBox ) { mData = 0; }; ~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()&& child->data() ) 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!") ); + QProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this ); + bar.setCaption (i18n("Importing!") ); 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.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 ); + bar.raise(); 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()).replace( QRegExp("\\r"), "") ); QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("; "), ";"); 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 ); |