-rw-r--r-- | kaddressbook/kabcore.cpp | 26 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 3 | ||||
-rw-r--r-- | kaddressbook/kaddressbook.pro | 11 | ||||
-rw-r--r-- | kaddressbook/kaimportoldialog.cpp | 635 | ||||
-rw-r--r-- | kaddressbook/kaimportoldialog.h | 85 |
5 files changed, 757 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7e3fc7c..f4263c4 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -65,148 +65,155 @@ | |||
65 | 65 | ||
66 | #include <kapplication.h> | 66 | #include <kapplication.h> |
67 | #include "KDGanttMinimizeSplitter.h" | 67 | #include "KDGanttMinimizeSplitter.h" |
68 | #include "kaddressbookmain.h" | 68 | #include "kaddressbookmain.h" |
69 | #include "kactioncollection.h" | 69 | #include "kactioncollection.h" |
70 | #include <qapp.h> | 70 | #include <qapp.h> |
71 | #include <qmenubar.h> | 71 | #include <qmenubar.h> |
72 | //#include <qtoolbar.h> | 72 | //#include <qtoolbar.h> |
73 | #include <qmessagebox.h> | 73 | #include <qmessagebox.h> |
74 | #include <kdebug.h> | 74 | #include <kdebug.h> |
75 | #include <kiconloader.h> // needed for SmallIcon | 75 | #include <kiconloader.h> // needed for SmallIcon |
76 | #include <kresources/kcmkresources.h> | 76 | #include <kresources/kcmkresources.h> |
77 | #include <ktoolbar.h> | 77 | #include <ktoolbar.h> |
78 | 78 | ||
79 | #include <kcmkabconfig.h> | 79 | #include <kcmkabconfig.h> |
80 | 80 | ||
81 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap | 81 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap |
82 | //#include <qlabel.h> | 82 | //#include <qlabel.h> |
83 | #endif // KAB_EMBEDDED | 83 | #endif // KAB_EMBEDDED |
84 | #include <kcmkabconfig.h> | 84 | #include <kcmkabconfig.h> |
85 | 85 | ||
86 | 86 | ||
87 | #include <kresources/selectdialog.h> | 87 | #include <kresources/selectdialog.h> |
88 | #include <kmessagebox.h> | 88 | #include <kmessagebox.h> |
89 | 89 | ||
90 | #include <picture.h> | 90 | #include <picture.h> |
91 | #include <resource.h> | 91 | #include <resource.h> |
92 | 92 | ||
93 | //US#include <qsplitter.h> | 93 | //US#include <qsplitter.h> |
94 | #include <qvbox.h> | 94 | #include <qvbox.h> |
95 | #include <qlayout.h> | 95 | #include <qlayout.h> |
96 | #include <qclipboard.h> | 96 | #include <qclipboard.h> |
97 | 97 | ||
98 | #include <libkdepim/categoryselectdialog.h> | 98 | #include <libkdepim/categoryselectdialog.h> |
99 | 99 | ||
100 | #include "addresseeutil.h" | 100 | #include "addresseeutil.h" |
101 | #include "undocmds.h" | 101 | #include "undocmds.h" |
102 | #include "addresseeeditordialog.h" | 102 | #include "addresseeeditordialog.h" |
103 | #include "viewmanager.h" | 103 | #include "viewmanager.h" |
104 | #include "details/detailsviewcontainer.h" | 104 | #include "details/detailsviewcontainer.h" |
105 | #include "kabprefs.h" | 105 | #include "kabprefs.h" |
106 | #include "xxportmanager.h" | 106 | #include "xxportmanager.h" |
107 | #include "incsearchwidget.h" | 107 | #include "incsearchwidget.h" |
108 | #include "jumpbuttonbar.h" | 108 | #include "jumpbuttonbar.h" |
109 | #include "extensionmanager.h" | 109 | #include "extensionmanager.h" |
110 | #include "addresseeconfig.h" | 110 | #include "addresseeconfig.h" |
111 | #include <kcmultidialog.h> | 111 | #include <kcmultidialog.h> |
112 | 112 | ||
113 | #ifdef _WIN32_ | ||
114 | |||
115 | #include "kaimportoldialog.h" | ||
116 | #endif | ||
117 | |||
113 | 118 | ||
114 | #ifdef KAB_EMBEDDED | 119 | #ifdef KAB_EMBEDDED |
115 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 120 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
116 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
117 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 122 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
118 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 123 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
119 | #else //KAB_EMBEDDED | 124 | #else //KAB_EMBEDDED |
120 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 125 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
121 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 126 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
122 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 127 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
123 | mReadWrite( readWrite ), mModified( false ) | 128 | mReadWrite( readWrite ), mModified( false ) |
124 | #endif //KAB_EMBEDDED | 129 | #endif //KAB_EMBEDDED |
125 | { | 130 | { |
126 | #ifdef KAB_EMBEDDED | 131 | #ifdef KAB_EMBEDDED |
127 | //US we define here our own global actioncollection. | 132 | //US we define here our own global actioncollection. |
128 | //mActionCollection = new KActionCollection(this); | 133 | //mActionCollection = new KActionCollection(this); |
129 | #endif //KAB_EMBEDDED | 134 | #endif //KAB_EMBEDDED |
130 | mExtensionBarSplitter = 0; | 135 | mExtensionBarSplitter = 0; |
131 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 136 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
132 | 137 | ||
133 | mAddressBook = KABC::StdAddressBook::self(); | 138 | mAddressBook = KABC::StdAddressBook::self(); |
134 | KABC::StdAddressBook::setAutomaticSave( false ); | 139 | KABC::StdAddressBook::setAutomaticSave( false ); |
135 | 140 | ||
136 | #ifndef KAB_EMBEDDED | 141 | #ifndef KAB_EMBEDDED |
137 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 142 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
138 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
139 | 144 | ||
140 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 145 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
141 | SLOT( addressBookChanged() ) ); | 146 | SLOT( addressBookChanged() ) ); |
142 | 147 | ||
143 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 148 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
144 | "X-Department", "KADDRESSBOOK" ); | 149 | "X-Department", "KADDRESSBOOK" ); |
145 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 150 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
146 | "X-Profession", "KADDRESSBOOK" ); | 151 | "X-Profession", "KADDRESSBOOK" ); |
147 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 152 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
148 | "X-AssistantsName", "KADDRESSBOOK" ); | 153 | "X-AssistantsName", "KADDRESSBOOK" ); |
149 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 154 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
150 | "X-ManagersName", "KADDRESSBOOK" ); | 155 | "X-ManagersName", "KADDRESSBOOK" ); |
151 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 156 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
152 | "X-SpousesName", "KADDRESSBOOK" ); | 157 | "X-SpousesName", "KADDRESSBOOK" ); |
153 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 158 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
154 | "X-Office", "KADDRESSBOOK" ); | 159 | "X-Office", "KADDRESSBOOK" ); |
155 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 160 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
156 | "X-IMAddress", "KADDRESSBOOK" ); | 161 | "X-IMAddress", "KADDRESSBOOK" ); |
157 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 162 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
158 | "X-Anniversary", "KADDRESSBOOK" ); | 163 | "X-Anniversary", "KADDRESSBOOK" ); |
159 | 164 | ||
160 | //US added this field to become compatible with Opie addressbook | 165 | //US added this field to become compatible with Opie addressbook |
161 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 166 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
162 | "X-Gender", "KADDRESSBOOK" ); | 167 | "X-Gender", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 168 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
164 | "X-Children", "KADDRESSBOOK" ); | 169 | "X-Children", "KADDRESSBOOK" ); |
170 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | ||
171 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | ||
165 | 172 | ||
166 | initGUI(); | 173 | initGUI(); |
167 | 174 | ||
168 | mIncSearchWidget->setFocus(); | 175 | mIncSearchWidget->setFocus(); |
169 | 176 | ||
170 | 177 | ||
171 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 178 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
172 | SLOT( setContactSelected( const QString& ) ) ); | 179 | SLOT( setContactSelected( const QString& ) ) ); |
173 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 180 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
174 | SLOT( editContact( const QString& ) ) ); | 181 | SLOT( editContact( const QString& ) ) ); |
175 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 182 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
176 | SLOT( deleteContacts( ) ) ); | 183 | SLOT( deleteContacts( ) ) ); |
177 | connect( mViewManager, SIGNAL( modified() ), | 184 | connect( mViewManager, SIGNAL( modified() ), |
178 | SLOT( setModified() ) ); | 185 | SLOT( setModified() ) ); |
179 | 186 | ||
180 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 187 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
181 | 188 | ||
182 | connect( mXXPortManager, SIGNAL( modified() ), | 189 | connect( mXXPortManager, SIGNAL( modified() ), |
183 | SLOT( setModified() ) ); | 190 | SLOT( setModified() ) ); |
184 | 191 | ||
185 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 192 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
186 | SLOT( incrementalSearch( const QString& ) ) ); | 193 | SLOT( incrementalSearch( const QString& ) ) ); |
187 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 194 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
188 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 195 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
189 | 196 | ||
190 | #ifndef KAB_EMBEDDED | 197 | #ifndef KAB_EMBEDDED |
191 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 198 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
192 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 199 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
193 | 200 | ||
194 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 201 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
195 | SLOT( sendMail( const QString& ) ) ); | 202 | SLOT( sendMail( const QString& ) ) ); |
196 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 203 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
197 | SLOT( browse( const QString& ) ) ); | 204 | SLOT( browse( const QString& ) ) ); |
198 | 205 | ||
199 | mAddressBookService = new KAddressBookService( this ); | 206 | mAddressBookService = new KAddressBookService( this ); |
200 | 207 | ||
201 | #endif //KAB_EMBEDDED | 208 | #endif //KAB_EMBEDDED |
202 | mEditorDialog = 0; | 209 | mEditorDialog = 0; |
203 | createAddresseeEditorDialog( this ); | 210 | createAddresseeEditorDialog( this ); |
204 | setModified( false ); | 211 | setModified( false ); |
205 | } | 212 | } |
206 | 213 | ||
207 | KABCore::~KABCore() | 214 | KABCore::~KABCore() |
208 | { | 215 | { |
209 | // save(); | 216 | // save(); |
210 | //saveSettings(); | 217 | //saveSettings(); |
211 | //KABPrefs::instance()->writeConfig(); | 218 | //KABPrefs::instance()->writeConfig(); |
212 | delete AddresseeConfig::instance(); | 219 | delete AddresseeConfig::instance(); |
@@ -796,96 +803,107 @@ void KABCore::newContact() | |||
796 | KApplication::execDialog ( mEditorDialog ); | 803 | KApplication::execDialog ( mEditorDialog ); |
797 | 804 | ||
798 | } else | 805 | } else |
799 | return; | 806 | return; |
800 | 807 | ||
801 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 808 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
802 | 809 | ||
803 | 810 | ||
804 | } | 811 | } |
805 | 812 | ||
806 | void KABCore::addEmail( QString aStr ) | 813 | void KABCore::addEmail( QString aStr ) |
807 | { | 814 | { |
808 | #ifndef KAB_EMBEDDED | 815 | #ifndef KAB_EMBEDDED |
809 | QString fullName, email; | 816 | QString fullName, email; |
810 | 817 | ||
811 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 818 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
812 | 819 | ||
813 | // Try to lookup the addressee matching the email address | 820 | // Try to lookup the addressee matching the email address |
814 | bool found = false; | 821 | bool found = false; |
815 | QStringList emailList; | 822 | QStringList emailList; |
816 | KABC::AddressBook::Iterator it; | 823 | KABC::AddressBook::Iterator it; |
817 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 824 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
818 | emailList = (*it).emails(); | 825 | emailList = (*it).emails(); |
819 | if ( emailList.contains( email ) > 0 ) { | 826 | if ( emailList.contains( email ) > 0 ) { |
820 | found = true; | 827 | found = true; |
821 | (*it).setNameFromString( fullName ); | 828 | (*it).setNameFromString( fullName ); |
822 | editContact( (*it).uid() ); | 829 | editContact( (*it).uid() ); |
823 | } | 830 | } |
824 | } | 831 | } |
825 | 832 | ||
826 | if ( !found ) { | 833 | if ( !found ) { |
827 | KABC::Addressee addr; | 834 | KABC::Addressee addr; |
828 | addr.setNameFromString( fullName ); | 835 | addr.setNameFromString( fullName ); |
829 | addr.insertEmail( email, true ); | 836 | addr.insertEmail( email, true ); |
830 | 837 | ||
831 | mAddressBook->insertAddressee( addr ); | 838 | mAddressBook->insertAddressee( addr ); |
832 | mViewManager->refreshView( addr.uid() ); | 839 | mViewManager->refreshView( addr.uid() ); |
833 | editContact( addr.uid() ); | 840 | editContact( addr.uid() ); |
834 | } | 841 | } |
835 | #else //KAB_EMBEDDED | 842 | #else //KAB_EMBEDDED |
836 | qDebug("KABCore::addEmail finsih method"); | 843 | qDebug("KABCore::addEmail finsih method"); |
837 | #endif //KAB_EMBEDDED | 844 | #endif //KAB_EMBEDDED |
838 | } | 845 | } |
839 | 846 | ||
840 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 847 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
841 | { | 848 | { |
842 | mXXPortManager->importVCard( url, showPreview ); | 849 | mXXPortManager->importVCard( url, showPreview ); |
843 | } | 850 | } |
851 | void KABCore::importFromOL() | ||
852 | { | ||
853 | #ifdef _WIN32_ | ||
854 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | ||
855 | idgl->exec(); | ||
856 | KABC::Addressee::List list = idgl->getAddressList(); | ||
857 | if ( list.count() > 0 ) | ||
858 | pasteContacts( list ); | ||
859 | delete idgl; | ||
860 | #endif | ||
861 | } | ||
844 | 862 | ||
845 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 863 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
846 | { | 864 | { |
847 | mXXPortManager->importVCard( vCard, showPreview ); | 865 | mXXPortManager->importVCard( vCard, showPreview ); |
848 | } | 866 | } |
849 | 867 | ||
850 | //US added a second method without defaultparameter | 868 | //US added a second method without defaultparameter |
851 | void KABCore::editContact2() { | 869 | void KABCore::editContact2() { |
852 | editContact( QString::null ); | 870 | editContact( QString::null ); |
853 | } | 871 | } |
854 | 872 | ||
855 | void KABCore::editContact( const QString &uid ) | 873 | void KABCore::editContact( const QString &uid ) |
856 | { | 874 | { |
857 | 875 | ||
858 | if ( mExtensionManager->isQuickEditVisible() ) | 876 | if ( mExtensionManager->isQuickEditVisible() ) |
859 | return; | 877 | return; |
860 | 878 | ||
861 | // First, locate the contact entry | 879 | // First, locate the contact entry |
862 | QString localUID = uid; | 880 | QString localUID = uid; |
863 | if ( localUID.isNull() ) { | 881 | if ( localUID.isNull() ) { |
864 | QStringList uidList = mViewManager->selectedUids(); | 882 | QStringList uidList = mViewManager->selectedUids(); |
865 | if ( uidList.count() > 0 ) | 883 | if ( uidList.count() > 0 ) |
866 | localUID = *( uidList.at( 0 ) ); | 884 | localUID = *( uidList.at( 0 ) ); |
867 | } | 885 | } |
868 | 886 | ||
869 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 887 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
870 | if ( !addr.isEmpty() ) { | 888 | if ( !addr.isEmpty() ) { |
871 | mEditorDialog->setAddressee( addr ); | 889 | mEditorDialog->setAddressee( addr ); |
872 | KApplication::execDialog ( mEditorDialog ); | 890 | KApplication::execDialog ( mEditorDialog ); |
873 | } | 891 | } |
874 | } | 892 | } |
875 | 893 | ||
876 | void KABCore::save() | 894 | void KABCore::save() |
877 | { | 895 | { |
878 | if ( !mModified ) | 896 | if ( !mModified ) |
879 | return; | 897 | return; |
880 | QString text = i18n( "There was an error while attempting to save\n the " | 898 | QString text = i18n( "There was an error while attempting to save\n the " |
881 | "address book. Please check that some \nother application is " | 899 | "address book. Please check that some \nother application is " |
882 | "not using it. " ); | 900 | "not using it. " ); |
883 | statusMessage(i18n("Saving addressbook ... ")); | 901 | statusMessage(i18n("Saving addressbook ... ")); |
884 | #ifndef KAB_EMBEDDED | 902 | #ifndef KAB_EMBEDDED |
885 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 903 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
886 | if ( !b || !b->save() ) { | 904 | if ( !b || !b->save() ) { |
887 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 905 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
888 | } | 906 | } |
889 | #else //KAB_EMBEDDED | 907 | #else //KAB_EMBEDDED |
890 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 908 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
891 | if ( !b || !b->save() ) { | 909 | if ( !b || !b->save() ) { |
@@ -1352,178 +1370,182 @@ void KABCore::initActions() | |||
1352 | "kaddressbook_configure" ); | 1370 | "kaddressbook_configure" ); |
1353 | 1371 | ||
1354 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1372 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1355 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1373 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1356 | "kaddressbook_configure_shortcuts" ); | 1374 | "kaddressbook_configure_shortcuts" ); |
1357 | #ifdef KAB_EMBEDDED | 1375 | #ifdef KAB_EMBEDDED |
1358 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1376 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1359 | mActionConfigureToolbars->setEnabled( false ); | 1377 | mActionConfigureToolbars->setEnabled( false ); |
1360 | #endif //KAB_EMBEDDED | 1378 | #endif //KAB_EMBEDDED |
1361 | 1379 | ||
1362 | } else { | 1380 | } else { |
1363 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1381 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1364 | 1382 | ||
1365 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1383 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1366 | } | 1384 | } |
1367 | 1385 | ||
1368 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1386 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1369 | actionCollection(), "options_show_jump_bar" ); | 1387 | actionCollection(), "options_show_jump_bar" ); |
1370 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1388 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1371 | 1389 | ||
1372 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1390 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1373 | actionCollection(), "options_show_details" ); | 1391 | actionCollection(), "options_show_details" ); |
1374 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1392 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1375 | 1393 | ||
1376 | // misc | 1394 | // misc |
1377 | // only enable LDAP lookup if we can handle the protocol | 1395 | // only enable LDAP lookup if we can handle the protocol |
1378 | #ifndef KAB_EMBEDDED | 1396 | #ifndef KAB_EMBEDDED |
1379 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1397 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1380 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1398 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1381 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1399 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1382 | "ldap_lookup" ); | 1400 | "ldap_lookup" ); |
1383 | } | 1401 | } |
1384 | #else //KAB_EMBEDDED | 1402 | #else //KAB_EMBEDDED |
1385 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1403 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1386 | #endif //KAB_EMBEDDED | 1404 | #endif //KAB_EMBEDDED |
1387 | 1405 | ||
1388 | 1406 | ||
1389 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1407 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1390 | SLOT( setWhoAmI() ), actionCollection(), | 1408 | SLOT( setWhoAmI() ), actionCollection(), |
1391 | "set_personal" ); | 1409 | "set_personal" ); |
1392 | 1410 | ||
1393 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1411 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1394 | SLOT( setCategories() ), actionCollection(), | 1412 | SLOT( setCategories() ), actionCollection(), |
1395 | "edit_set_categories" ); | 1413 | "edit_set_categories" ); |
1396 | 1414 | ||
1397 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1415 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1398 | SLOT( removeVoice() ), actionCollection(), | 1416 | SLOT( removeVoice() ), actionCollection(), |
1399 | "remove_voice" ); | 1417 | "remove_voice" ); |
1418 | mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this, | ||
1419 | SLOT( importFromOL() ), actionCollection(), | ||
1420 | "import_OL" ); | ||
1400 | #ifdef KAB_EMBEDDED | 1421 | #ifdef KAB_EMBEDDED |
1401 | 1422 | ||
1402 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1423 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1403 | this, SLOT( createAboutData() ), actionCollection(), | 1424 | this, SLOT( createAboutData() ), actionCollection(), |
1404 | "kaddressbook_about_data" ); | 1425 | "kaddressbook_about_data" ); |
1405 | #endif //KAB_EMBEDDED | 1426 | #endif //KAB_EMBEDDED |
1406 | 1427 | ||
1407 | clipboardDataChanged(); | 1428 | clipboardDataChanged(); |
1408 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1429 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1409 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1430 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1410 | } | 1431 | } |
1411 | 1432 | ||
1412 | //US we need this function, to plug all actions into the correct menues. | 1433 | //US we need this function, to plug all actions into the correct menues. |
1413 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1434 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1414 | void KABCore::addActionsManually() | 1435 | void KABCore::addActionsManually() |
1415 | { | 1436 | { |
1416 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1437 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1417 | 1438 | ||
1418 | #ifdef KAB_EMBEDDED | 1439 | #ifdef KAB_EMBEDDED |
1419 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1440 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1420 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1441 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1421 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1442 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1422 | 1443 | ||
1423 | KToolBar* tb = mMainWindow->toolBar(); | 1444 | KToolBar* tb = mMainWindow->toolBar(); |
1424 | 1445 | ||
1425 | #ifdef DESKTOP_VERSION | 1446 | #ifdef DESKTOP_VERSION |
1426 | QMenuBar* mb = mMainWindow->menuBar(); | 1447 | QMenuBar* mb = mMainWindow->menuBar(); |
1427 | 1448 | ||
1428 | //US setup menubar. | 1449 | //US setup menubar. |
1429 | //Disable the following block if you do not want to have a menubar. | 1450 | //Disable the following block if you do not want to have a menubar. |
1430 | mb->insertItem( "&File", fileMenu ); | 1451 | mb->insertItem( "&File", fileMenu ); |
1431 | mb->insertItem( "&Edit", editMenu ); | 1452 | mb->insertItem( "&Edit", editMenu ); |
1432 | mb->insertItem( "&View", viewMenu ); | 1453 | mb->insertItem( "&View", viewMenu ); |
1433 | mb->insertItem( "&Settings", settingsMenu ); | 1454 | mb->insertItem( "&Settings", settingsMenu ); |
1434 | mb->insertItem( "&Change selected", changeMenu ); | 1455 | mb->insertItem( "&Change selected", changeMenu ); |
1435 | mb->insertItem( "&Help", helpMenu ); | 1456 | mb->insertItem( "&Help", helpMenu ); |
1436 | mIncSearchWidget = new IncSearchWidget( tb ); | 1457 | mIncSearchWidget = new IncSearchWidget( tb ); |
1437 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1458 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1438 | 1459 | ||
1439 | #else | 1460 | #else |
1440 | //US setup toolbar | 1461 | //US setup toolbar |
1441 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1462 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1442 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1463 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1443 | menuBarTB->insertItem( "ME", popupBarTB); | 1464 | menuBarTB->insertItem( "ME", popupBarTB); |
1444 | tb->insertWidget(-1, 0, menuBarTB); | 1465 | tb->insertWidget(-1, 0, menuBarTB); |
1445 | mIncSearchWidget = new IncSearchWidget( tb ); | 1466 | mIncSearchWidget = new IncSearchWidget( tb ); |
1446 | 1467 | ||
1447 | tb->enableMoving(false); | 1468 | tb->enableMoving(false); |
1448 | popupBarTB->insertItem( "&File", fileMenu ); | 1469 | popupBarTB->insertItem( "&File", fileMenu ); |
1449 | popupBarTB->insertItem( "&Edit", editMenu ); | 1470 | popupBarTB->insertItem( "&Edit", editMenu ); |
1450 | popupBarTB->insertItem( "&View", viewMenu ); | 1471 | popupBarTB->insertItem( "&View", viewMenu ); |
1451 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1472 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1452 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1473 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1453 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1474 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1454 | popupBarTB->insertItem( "&Help", helpMenu ); | 1475 | popupBarTB->insertItem( "&Help", helpMenu ); |
1455 | if (QApplication::desktop()->width() > 320 ) { | 1476 | if (QApplication::desktop()->width() > 320 ) { |
1456 | // mViewManager->getFilterAction()->plug ( tb); | 1477 | // mViewManager->getFilterAction()->plug ( tb); |
1457 | } | 1478 | } |
1458 | #endif | 1479 | #endif |
1459 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1480 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1460 | 1481 | ||
1461 | 1482 | ||
1462 | 1483 | ||
1463 | //US Now connect the actions with the menue entries. | 1484 | //US Now connect the actions with the menue entries. |
1464 | mActionPrint->plug( fileMenu ); | 1485 | mActionPrint->plug( fileMenu ); |
1465 | mActionMail->plug( fileMenu ); | 1486 | mActionMail->plug( fileMenu ); |
1466 | fileMenu->insertSeparator(); | 1487 | fileMenu->insertSeparator(); |
1467 | 1488 | ||
1468 | mActionNewContact->plug( fileMenu ); | 1489 | mActionNewContact->plug( fileMenu ); |
1469 | mActionNewContact->plug( tb ); | 1490 | mActionNewContact->plug( tb ); |
1470 | 1491 | ||
1471 | mActionEditAddressee->plug( fileMenu ); | 1492 | mActionEditAddressee->plug( fileMenu ); |
1472 | fileMenu->insertSeparator(); | 1493 | fileMenu->insertSeparator(); |
1473 | mActionSave->plug( fileMenu ); | 1494 | mActionSave->plug( fileMenu ); |
1474 | fileMenu->insertItem( "&Import", ImportMenu ); | 1495 | fileMenu->insertItem( "&Import", ImportMenu ); |
1475 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1496 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1476 | fileMenu->insertSeparator(); | 1497 | fileMenu->insertSeparator(); |
1477 | mActionMailVCard->plug( fileMenu ); | 1498 | mActionMailVCard->plug( fileMenu ); |
1478 | fileMenu->insertSeparator(); | 1499 | fileMenu->insertSeparator(); |
1479 | mActionQuit->plug( fileMenu ); | 1500 | mActionQuit->plug( fileMenu ); |
1480 | 1501 | #ifdef _WIN32_ | |
1481 | 1502 | mActionImportOL->plug( ImportMenu ); | |
1503 | #endif | ||
1482 | // edit menu | 1504 | // edit menu |
1483 | mActionUndo->plug( editMenu ); | 1505 | mActionUndo->plug( editMenu ); |
1484 | mActionRedo->plug( editMenu ); | 1506 | mActionRedo->plug( editMenu ); |
1485 | editMenu->insertSeparator(); | 1507 | editMenu->insertSeparator(); |
1486 | mActionCut->plug( editMenu ); | 1508 | mActionCut->plug( editMenu ); |
1487 | mActionCopy->plug( editMenu ); | 1509 | mActionCopy->plug( editMenu ); |
1488 | mActionPaste->plug( editMenu ); | 1510 | mActionPaste->plug( editMenu ); |
1489 | mActionDelete->plug( editMenu ); | 1511 | mActionDelete->plug( editMenu ); |
1490 | editMenu->insertSeparator(); | 1512 | editMenu->insertSeparator(); |
1491 | mActionSelectAll->plug( editMenu ); | 1513 | mActionSelectAll->plug( editMenu ); |
1492 | 1514 | ||
1493 | mActionRemoveVoice->plug( changeMenu ); | 1515 | mActionRemoveVoice->plug( changeMenu ); |
1494 | // settings menu | 1516 | // settings menu |
1495 | //US special menuentry to configure the addressbook resources. On KDE | 1517 | //US special menuentry to configure the addressbook resources. On KDE |
1496 | // you do that through the control center !!! | 1518 | // you do that through the control center !!! |
1497 | mActionConfigResources->plug( settingsMenu ); | 1519 | mActionConfigResources->plug( settingsMenu ); |
1498 | settingsMenu->insertSeparator(); | 1520 | settingsMenu->insertSeparator(); |
1499 | 1521 | ||
1500 | mActionConfigKAddressbook->plug( settingsMenu ); | 1522 | mActionConfigKAddressbook->plug( settingsMenu ); |
1501 | 1523 | ||
1502 | if ( mIsPart ) { | 1524 | if ( mIsPart ) { |
1503 | mActionConfigShortcuts->plug( settingsMenu ); | 1525 | mActionConfigShortcuts->plug( settingsMenu ); |
1504 | mActionConfigureToolbars->plug( settingsMenu ); | 1526 | mActionConfigureToolbars->plug( settingsMenu ); |
1505 | 1527 | ||
1506 | } else { | 1528 | } else { |
1507 | mActionKeyBindings->plug( settingsMenu ); | 1529 | mActionKeyBindings->plug( settingsMenu ); |
1508 | } | 1530 | } |
1509 | 1531 | ||
1510 | settingsMenu->insertSeparator(); | 1532 | settingsMenu->insertSeparator(); |
1511 | 1533 | ||
1512 | mActionJumpBar->plug( settingsMenu ); | 1534 | mActionJumpBar->plug( settingsMenu ); |
1513 | mActionDetails->plug( settingsMenu ); | 1535 | mActionDetails->plug( settingsMenu ); |
1514 | settingsMenu->insertSeparator(); | 1536 | settingsMenu->insertSeparator(); |
1515 | 1537 | ||
1516 | mActionWhoAmI->plug( settingsMenu ); | 1538 | mActionWhoAmI->plug( settingsMenu ); |
1517 | mActionCategories->plug( settingsMenu ); | 1539 | mActionCategories->plug( settingsMenu ); |
1518 | 1540 | ||
1519 | mActionAboutKAddressbook->plug( helpMenu ); | 1541 | mActionAboutKAddressbook->plug( helpMenu ); |
1520 | 1542 | ||
1521 | 1543 | ||
1522 | if (QApplication::desktop()->width() > 320 ) { | 1544 | if (QApplication::desktop()->width() > 320 ) { |
1523 | 1545 | ||
1524 | mActionEditAddressee->plug( tb ); | 1546 | mActionEditAddressee->plug( tb ); |
1525 | mActionSave->plug( tb ); | 1547 | mActionSave->plug( tb ); |
1526 | mViewManager->getFilterAction()->plug ( tb); | 1548 | mViewManager->getFilterAction()->plug ( tb); |
1527 | if (QApplication::desktop()->width() > 480 ) { | 1549 | if (QApplication::desktop()->width() > 480 ) { |
1528 | mActionUndo->plug( tb ); | 1550 | mActionUndo->plug( tb ); |
1529 | mActionDelete->plug( tb ); | 1551 | mActionDelete->plug( tb ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 8d6041e..69a98a5 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -273,153 +273,154 @@ class KABCore : public QWidget | |||
273 | 273 | ||
274 | /** | 274 | /** |
275 | Undos the last command using the undo stack. | 275 | Undos the last command using the undo stack. |
276 | */ | 276 | */ |
277 | void undo(); | 277 | void undo(); |
278 | 278 | ||
279 | /** | 279 | /** |
280 | Redos the last command that was undone, using the redo stack. | 280 | Redos the last command that was undone, using the redo stack. |
281 | */ | 281 | */ |
282 | void redo(); | 282 | void redo(); |
283 | 283 | ||
284 | /** | 284 | /** |
285 | Shows the edit dialog for the given uid. If the uid is QString::null, | 285 | Shows the edit dialog for the given uid. If the uid is QString::null, |
286 | the method will try to find a selected addressee in the view. | 286 | the method will try to find a selected addressee in the view. |
287 | */ | 287 | */ |
288 | void editContact( const QString &uid /*US = QString::null*/ ); | 288 | void editContact( const QString &uid /*US = QString::null*/ ); |
289 | //US added a second method without defaultparameter | 289 | //US added a second method without defaultparameter |
290 | void editContact2(); | 290 | void editContact2(); |
291 | 291 | ||
292 | /** | 292 | /** |
293 | Launches the configuration dialog. | 293 | Launches the configuration dialog. |
294 | */ | 294 | */ |
295 | void openConfigDialog(); | 295 | void openConfigDialog(); |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Launches the ldap search dialog. | 298 | Launches the ldap search dialog. |
299 | */ | 299 | */ |
300 | void openLDAPDialog(); | 300 | void openLDAPDialog(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Creates a KAddressBookPrinter, which will display the print | 303 | Creates a KAddressBookPrinter, which will display the print |
304 | dialog and do the printing. | 304 | dialog and do the printing. |
305 | */ | 305 | */ |
306 | void print(); | 306 | void print(); |
307 | 307 | ||
308 | /** | 308 | /** |
309 | Registers a new GUI client, so plugins can register its actions. | 309 | Registers a new GUI client, so plugins can register its actions. |
310 | */ | 310 | */ |
311 | void addGUIClient( KXMLGUIClient *client ); | 311 | void addGUIClient( KXMLGUIClient *client ); |
312 | 312 | ||
313 | signals: | 313 | signals: |
314 | void contactSelected( const QString &name ); | 314 | void contactSelected( const QString &name ); |
315 | void contactSelected( const QPixmap &pixmap ); | 315 | void contactSelected( const QPixmap &pixmap ); |
316 | public slots: | 316 | public slots: |
317 | void setDetailsVisible( bool visible ); | 317 | void setDetailsVisible( bool visible ); |
318 | void setDetailsToState(); | 318 | void setDetailsToState(); |
319 | private slots: | 319 | private slots: |
320 | void setJumpButtonBarVisible( bool visible ); | 320 | void setJumpButtonBarVisible( bool visible ); |
321 | 321 | void importFromOL(); | |
322 | void extensionModified( const KABC::Addressee::List &list ); | 322 | void extensionModified( const KABC::Addressee::List &list ); |
323 | void clipboardDataChanged(); | 323 | void clipboardDataChanged(); |
324 | void updateActionMenu(); | 324 | void updateActionMenu(); |
325 | void configureKeyBindings(); | 325 | void configureKeyBindings(); |
326 | void removeVoice(); | 326 | void removeVoice(); |
327 | #ifdef KAB_EMBEDDED | 327 | #ifdef KAB_EMBEDDED |
328 | void configureResources(); | 328 | void configureResources(); |
329 | #endif //KAB_EMBEDDED | 329 | #endif //KAB_EMBEDDED |
330 | 330 | ||
331 | void slotEditorDestroyed( const QString &uid ); | 331 | void slotEditorDestroyed( const QString &uid ); |
332 | void configurationChanged(); | 332 | void configurationChanged(); |
333 | void addressBookChanged(); | 333 | void addressBookChanged(); |
334 | 334 | ||
335 | private: | 335 | private: |
336 | void initGUI(); | 336 | void initGUI(); |
337 | void initActions(); | 337 | void initActions(); |
338 | 338 | ||
339 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 339 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
340 | const char *name = 0 ); | 340 | const char *name = 0 ); |
341 | 341 | ||
342 | KXMLGUIClient *mGUIClient; | 342 | KXMLGUIClient *mGUIClient; |
343 | 343 | ||
344 | KABC::AddressBook *mAddressBook; | 344 | KABC::AddressBook *mAddressBook; |
345 | 345 | ||
346 | ViewManager *mViewManager; | 346 | ViewManager *mViewManager; |
347 | // QSplitter *mDetailsSplitter; | 347 | // QSplitter *mDetailsSplitter; |
348 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 348 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
349 | ViewContainer *mDetails; | 349 | ViewContainer *mDetails; |
350 | KDGanttMinimizeSplitter* mMiniSplitter; | 350 | KDGanttMinimizeSplitter* mMiniSplitter; |
351 | XXPortManager *mXXPortManager; | 351 | XXPortManager *mXXPortManager; |
352 | JumpButtonBar *mJumpButtonBar; | 352 | JumpButtonBar *mJumpButtonBar; |
353 | IncSearchWidget *mIncSearchWidget; | 353 | IncSearchWidget *mIncSearchWidget; |
354 | ExtensionManager *mExtensionManager; | 354 | ExtensionManager *mExtensionManager; |
355 | 355 | ||
356 | KCMultiDialog *mConfigureDialog; | 356 | KCMultiDialog *mConfigureDialog; |
357 | 357 | ||
358 | #ifndef KAB_EMBEDDED | 358 | #ifndef KAB_EMBEDDED |
359 | 359 | ||
360 | KCMultiDialog *mConfigureDialog; | 360 | KCMultiDialog *mConfigureDialog; |
361 | LDAPSearchDialog *mLdapSearchDialog; | 361 | LDAPSearchDialog *mLdapSearchDialog; |
362 | #endif //KAB_EMBEDDED | 362 | #endif //KAB_EMBEDDED |
363 | // QDict<AddresseeEditorDialog> mEditorDict; | 363 | // QDict<AddresseeEditorDialog> mEditorDict; |
364 | AddresseeEditorDialog *mEditorDialog; | 364 | AddresseeEditorDialog *mEditorDialog; |
365 | bool mReadWrite; | 365 | bool mReadWrite; |
366 | bool mModified; | 366 | bool mModified; |
367 | bool mIsPart; | 367 | bool mIsPart; |
368 | 368 | ||
369 | //US file menu | 369 | //US file menu |
370 | KAction *mActionMail; | 370 | KAction *mActionMail; |
371 | KAction* mActionPrint; | 371 | KAction* mActionPrint; |
372 | KAction* mActionNewContact; | 372 | KAction* mActionNewContact; |
373 | KAction *mActionSave; | 373 | KAction *mActionSave; |
374 | KAction *mActionEditAddressee; | 374 | KAction *mActionEditAddressee; |
375 | KAction *mActionMailVCard; | 375 | KAction *mActionMailVCard; |
376 | KAction *mActionQuit; | 376 | KAction *mActionQuit; |
377 | 377 | ||
378 | //US edit menu | 378 | //US edit menu |
379 | KAction *mActionCopy; | 379 | KAction *mActionCopy; |
380 | KAction *mActionCut; | 380 | KAction *mActionCut; |
381 | KAction *mActionPaste; | 381 | KAction *mActionPaste; |
382 | KAction *mActionSelectAll; | 382 | KAction *mActionSelectAll; |
383 | KAction *mActionUndo; | 383 | KAction *mActionUndo; |
384 | KAction *mActionRedo; | 384 | KAction *mActionRedo; |
385 | KAction *mActionDelete; | 385 | KAction *mActionDelete; |
386 | 386 | ||
387 | //US settings menu | 387 | //US settings menu |
388 | KAction *mActionConfigResources; | 388 | KAction *mActionConfigResources; |
389 | KAction *mActionConfigKAddressbook; | 389 | KAction *mActionConfigKAddressbook; |
390 | KAction *mActionConfigShortcuts; | 390 | KAction *mActionConfigShortcuts; |
391 | KAction *mActionConfigureToolbars; | 391 | KAction *mActionConfigureToolbars; |
392 | KAction *mActionKeyBindings; | 392 | KAction *mActionKeyBindings; |
393 | KToggleAction *mActionJumpBar; | 393 | KToggleAction *mActionJumpBar; |
394 | KToggleAction *mActionDetails; | 394 | KToggleAction *mActionDetails; |
395 | KAction *mActionWhoAmI; | 395 | KAction *mActionWhoAmI; |
396 | KAction *mActionCategories; | 396 | KAction *mActionCategories; |
397 | KAction *mActionAboutKAddressbook; | 397 | KAction *mActionAboutKAddressbook; |
398 | 398 | ||
399 | KAction *mActionDeleteView; | 399 | KAction *mActionDeleteView; |
400 | 400 | ||
401 | QPopupMenu *viewMenu; | 401 | QPopupMenu *viewMenu; |
402 | QPopupMenu *filterMenu; | 402 | QPopupMenu *filterMenu; |
403 | QPopupMenu *settingsMenu; | 403 | QPopupMenu *settingsMenu; |
404 | QPopupMenu *changeMenu; | 404 | QPopupMenu *changeMenu; |
405 | 405 | ||
406 | //US QAction *mActionSave; | 406 | //US QAction *mActionSave; |
407 | QPopupMenu *ImportMenu; | 407 | QPopupMenu *ImportMenu; |
408 | QPopupMenu *ExportMenu; | 408 | QPopupMenu *ExportMenu; |
409 | //LR additional methods | 409 | //LR additional methods |
410 | KAction *mActionRemoveVoice; | 410 | KAction *mActionRemoveVoice; |
411 | KAction * mActionImportOL; | ||
411 | 412 | ||
412 | #ifndef KAB_EMBEDDED | 413 | #ifndef KAB_EMBEDDED |
413 | KAddressBookService *mAddressBookService; | 414 | KAddressBookService *mAddressBookService; |
414 | #endif //KAB_EMBEDDED | 415 | #endif //KAB_EMBEDDED |
415 | 416 | ||
416 | class KABCorePrivate; | 417 | class KABCorePrivate; |
417 | KABCorePrivate *d; | 418 | KABCorePrivate *d; |
418 | 419 | ||
419 | #ifdef KAB_EMBEDDED | 420 | #ifdef KAB_EMBEDDED |
420 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 421 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
421 | #endif //KAB_EMBEDDED | 422 | #endif //KAB_EMBEDDED |
422 | 423 | ||
423 | }; | 424 | }; |
424 | 425 | ||
425 | #endif | 426 | #endif |
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro index 761c3e7..bc14e68 100644 --- a/kaddressbook/kaddressbook.pro +++ b/kaddressbook/kaddressbook.pro | |||
@@ -1,77 +1,78 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | TARGET = kapi | 3 | TARGET = kapi |
4 | DESTDIR= ../bin | 4 | DESTDIR= ../bin |
5 | 5 | ||
6 | include( ../variables.pri ) | 6 | include( ../variables.pri ) |
7 | 7 | ||
8 | 8 | ||
9 | INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kdeui ../kabc ../ interfaces | 9 | INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kdeui ../kabc ../ interfaces |
10 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION | 10 | DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION |
11 | 11 | ||
12 | unix : { | 12 | unix : { |
13 | LIBS += ../bin/libmicrokdepim.so | 13 | LIBS += ../bin/libmicrokdepim.so |
14 | LIBS += ../bin/libmicrokde.so | 14 | LIBS += ../bin/libmicrokde.so |
15 | LIBS += ../bin/libmicrokabc.so | 15 | LIBS += ../bin/libmicrokabc.so |
16 | LIBS += ../bin/libmicrokcal.so | 16 | LIBS += ../bin/libmicrokcal.so |
17 | LIBS += -lldap | 17 | LIBS += -lldap |
18 | OBJECTS_DIR = obj/unix | 18 | OBJECTS_DIR = obj/unix |
19 | MOC_DIR = moc/unix | 19 | MOC_DIR = moc/unix |
20 | } | 20 | } |
21 | win32: { | 21 | win32: { |
22 | DEFINES += _WIN32_ | 22 | DEFINES += _WIN32_ |
23 | LIBS += ../bin/microkdepim.lib | 23 | LIBS += ../bin/microkdepim.lib |
24 | LIBS += ../bin/microkcal.lib | 24 | LIBS += ../bin/microkcal.lib |
25 | LIBS += ../bin/microkde.lib | 25 | LIBS += ../bin/microkde.lib |
26 | LIBS += ../bin/microkabc.lib | 26 | LIBS += ../bin/microkabc.lib |
27 | QMAKE_LINK += /NODEFAULTLIB:LIBC | 27 | QMAKE_LINK += /NODEFAULTLIB:LIBC |
28 | OBJECTS_DIR = obj/win | 28 | OBJECTS_DIR = obj/win |
29 | MOC_DIR = moc/win | 29 | MOC_DIR = moc/win |
30 | LIBS += mfc71u.lib | ||
30 | } | 31 | } |
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | 35 | ||
35 | 36 | ||
36 | 37 | ||
37 | 38 | ||
38 | 39 | ||
39 | INTERFACES = \ | 40 | INTERFACES = \ |
40 | # filteredit_base.ui \ | 41 | # filteredit_base.ui \ |
41 | # kofilterview_base.ui \ | 42 | # kofilterview_base.ui \ |
42 | 43 | ||
43 | HEADERS = \ | 44 | HEADERS = \ |
44 | features/mergewidget.h \ | 45 | features/mergewidget.h \ |
45 | features/distributionlistwidget.h \ | 46 | features/distributionlistwidget.h \ |
46 | kcmconfigs/addresseewidget.h \ | 47 | kcmconfigs/addresseewidget.h \ |
47 | kcmconfigs/extensionconfigdialog.h \ | 48 | kcmconfigs/extensionconfigdialog.h \ |
48 | kcmconfigs/kcmkabconfig.h \ | 49 | kcmconfigs/kcmkabconfig.h \ |
49 | kcmconfigs/kabconfigwidget.h \ | 50 | kcmconfigs/kabconfigwidget.h \ |
50 | addresseeeditordialog.h \ | 51 | addresseeeditordialog.h \ |
51 | addresseeeditorwidget.h \ | 52 | addresseeeditorwidget.h \ |
52 | addresseditwidget.h \ | 53 | addresseditwidget.h \ |
53 | addresseeconfig.h \ | 54 | addresseeconfig.h \ |
54 | addresseeutil.h \ | 55 | addresseeutil.h \ |
55 | emaileditwidget.h \ | 56 | emaileditwidget.h \ |
56 | filtereditdialog.h \ | 57 | filtereditdialog.h \ |
57 | kaddressbookmain.h \ | 58 | kaddressbookmain.h \ |
58 | kabprefs.h \ | 59 | kabprefs.h \ |
59 | kabcore.h \ | 60 | kabcore.h \ |
60 | viewmanager.h \ | 61 | viewmanager.h \ |
61 | extensionmanager.h \ | 62 | extensionmanager.h \ |
62 | extensionwidget.h \ | 63 | extensionwidget.h \ |
63 | kaddressbookview.h \ | 64 | kaddressbookview.h \ |
64 | geowidget.h \ | 65 | geowidget.h \ |
65 | imagewidget.h \ | 66 | imagewidget.h \ |
66 | incsearchwidget.h \ | 67 | incsearchwidget.h \ |
67 | jumpbuttonbar.h \ | 68 | jumpbuttonbar.h \ |
68 | phoneeditwidget.h \ | 69 | phoneeditwidget.h \ |
69 | secrecywidget.h \ | 70 | secrecywidget.h \ |
70 | keywidget.h \ | 71 | keywidget.h \ |
71 | nameeditdialog.h \ | 72 | nameeditdialog.h \ |
72 | filter.h \ | 73 | filter.h \ |
73 | addviewdialog.h \ | 74 | addviewdialog.h \ |
74 | configurewidget.h \ | 75 | configurewidget.h \ |
75 | viewconfigurewidget.h \ | 76 | viewconfigurewidget.h \ |
76 | viewconfigurefieldspage.h \ | 77 | viewconfigurefieldspage.h \ |
77 | viewconfigurefilterpage.h \ | 78 | viewconfigurefilterpage.h \ |
@@ -119,48 +120,58 @@ kcmconfigs/kabconfigwidget.cpp \ | |||
119 | emaileditwidget.cpp \ | 120 | emaileditwidget.cpp \ |
120 | filtereditdialog.cpp \ | 121 | filtereditdialog.cpp \ |
121 | mainembedded.cpp \ | 122 | mainembedded.cpp \ |
122 | kaddressbookmain.cpp \ | 123 | kaddressbookmain.cpp \ |
123 | kabcore.cpp \ | 124 | kabcore.cpp \ |
124 | kabprefs.cpp \ | 125 | kabprefs.cpp \ |
125 | viewmanager.cpp \ | 126 | viewmanager.cpp \ |
126 | kaddressbookview.cpp \ | 127 | kaddressbookview.cpp \ |
127 | extensionwidget.cpp \ | 128 | extensionwidget.cpp \ |
128 | geowidget.cpp \ | 129 | geowidget.cpp \ |
129 | imagewidget.cpp \ | 130 | imagewidget.cpp \ |
130 | incsearchwidget.cpp \ | 131 | incsearchwidget.cpp \ |
131 | jumpbuttonbar.cpp \ | 132 | jumpbuttonbar.cpp \ |
132 | phoneeditwidget.cpp \ | 133 | phoneeditwidget.cpp \ |
133 | secrecywidget.cpp \ | 134 | secrecywidget.cpp \ |
134 | keywidget.cpp \ | 135 | keywidget.cpp \ |
135 | nameeditdialog.cpp \ | 136 | nameeditdialog.cpp \ |
136 | filter.cpp \ | 137 | filter.cpp \ |
137 | addviewdialog.cpp \ | 138 | addviewdialog.cpp \ |
138 | configurewidget.cpp \ | 139 | configurewidget.cpp \ |
139 | viewconfigurewidget.cpp \ | 140 | viewconfigurewidget.cpp \ |
140 | viewconfigurefieldspage.cpp \ | 141 | viewconfigurefieldspage.cpp \ |
141 | viewconfigurefilterpage.cpp \ | 142 | viewconfigurefilterpage.cpp \ |
142 | undo.cpp \ | 143 | undo.cpp \ |
143 | undocmds.cpp \ | 144 | undocmds.cpp \ |
144 | xxportmanager.cpp \ | 145 | xxportmanager.cpp \ |
145 | xxportobject.cpp \ | 146 | xxportobject.cpp \ |
146 | xxportselectdialog.cpp \ | 147 | xxportselectdialog.cpp \ |
147 | details/detailsviewcontainer.cpp \ | 148 | details/detailsviewcontainer.cpp \ |
148 | details/look_basic.cpp \ | 149 | details/look_basic.cpp \ |
149 | details/look_html.cpp \ | 150 | details/look_html.cpp \ |
150 | views/kaddressbookiconview.cpp \ | 151 | views/kaddressbookiconview.cpp \ |
151 | views/kaddressbooktableview.cpp \ | 152 | views/kaddressbooktableview.cpp \ |
152 | views/kaddressbookcardview.cpp \ | 153 | views/kaddressbookcardview.cpp \ |
153 | views/configuretableviewdialog.cpp \ | 154 | views/configuretableviewdialog.cpp \ |
154 | views/configurecardviewdialog.cpp \ | 155 | views/configurecardviewdialog.cpp \ |
155 | views/cardview.cpp \ | 156 | views/cardview.cpp \ |
156 | views/contactlistview.cpp \ | 157 | views/contactlistview.cpp \ |
157 | views/colorlistbox.cpp \ | 158 | views/colorlistbox.cpp \ |
158 | xxport/vcard_xxport.cpp \ | 159 | xxport/vcard_xxport.cpp \ |
159 | xxport/kde2_xxport.cpp \ | 160 | xxport/kde2_xxport.cpp \ |
160 | xxport/csv_xxport.cpp \ | 161 | xxport/csv_xxport.cpp \ |
161 | xxport/csvimportdialog.cpp \ | 162 | xxport/csvimportdialog.cpp \ |
162 | #details/look_details.cpp \ | 163 | #details/look_details.cpp \ |
163 | #mainwindow.cpp \ | 164 | #mainwindow.cpp \ |
164 | # calendarview.cpp \ | 165 | # calendarview.cpp \ |
165 | # timespanview.cpp | 166 | # timespanview.cpp |
166 | 167 | ||
168 | |||
169 | |||
170 | win32: { | ||
171 | HEADERS += ../outport/msoutl9.h \ | ||
172 | kaimportoldialog.h | ||
173 | |||
174 | SOURCES += ../outport/msoutl9.cpp \ | ||
175 | kaimportoldialog.cpp | ||
176 | } | ||
177 | |||
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp new file mode 100644 index 0000000..5e7d7c4 --- a/dev/null +++ b/kaddressbook/kaimportoldialog.cpp | |||
@@ -0,0 +1,635 @@ | |||
1 | /* | ||
2 | This file is part of KAddressbook/Pi. | ||
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <qtooltip.h> | ||
25 | #include <qframe.h> | ||
26 | #include <qpixmap.h> | ||
27 | #include <qlayout.h> | ||
28 | #include <qprogressbar.h> | ||
29 | #include <qwidgetstack.h> | ||
30 | #include <qdatetime.h> | ||
31 | #include <qdir.h> | ||
32 | #include <qapplication.h> | ||
33 | #include <qhbox.h> | ||
34 | #include <qheader.h> | ||
35 | #include <qdatetime.h> | ||
36 | #include <qlistview.h> | ||
37 | |||
38 | #include <kdebug.h> | ||
39 | #include <klocale.h> | ||
40 | #include <kstandarddirs.h> | ||
41 | #include <kmessagebox.h> | ||
42 | #include <kfiledialog.h> | ||
43 | |||
44 | #include <libkdepim/categoryselectdialog.h> | ||
45 | #include <libkdepim/kinputdialog.h> | ||
46 | |||
47 | #include <libkcal/calendarlocal.h> | ||
48 | #include <libkcal/icalformat.h> | ||
49 | |||
50 | #include <kabc/addresseelist.h> | ||
51 | #include <kabc/phonenumber.h> | ||
52 | |||
53 | #include "kaimportoldialog.h" | ||
54 | |||
55 | #include "../outport/msoutl9.h" | ||
56 | #include <ole2.h> | ||
57 | #include <comutil.h> | ||
58 | _Application gOlAppAB; | ||
59 | |||
60 | QDateTime mDdate2Qdtr( DATE dt) | ||
61 | { | ||
62 | COleDateTime odt; | ||
63 | SYSTEMTIME st; | ||
64 | odt = dt; | ||
65 | if ( odt.GetStatus() != 0 ) | ||
66 | return QDateTime(); | ||
67 | odt.GetAsSystemTime(st); | ||
68 | if ( st.wYear > 4000 ) // this program as a year 4000 bug! | ||
69 | return QDateTime(); | ||
70 | // it seems so, that 1.1.4501 indicates: DATE invalid | ||
71 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); | ||
72 | return qdt; | ||
73 | } | ||
74 | |||
75 | class OLEListViewItem : public QCheckListItem | ||
76 | { | ||
77 | public: | ||
78 | OLEListViewItem( QListView *parent, QString text ) : | ||
79 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; | ||
80 | OLEListViewItem( QListViewItem *after, QString text ) : | ||
81 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; | ||
82 | ~OLEListViewItem() {}; | ||
83 | void setData( DWORD data ) {mData= data; }; | ||
84 | DWORD data() { return mData ;}; | ||
85 | private: | ||
86 | DWORD mData; | ||
87 | }; | ||
88 | |||
89 | KAImportOLdialog::KAImportOLdialog( const QString &caption, | ||
90 | KABC::AddressBook * aBook, QWidget *parent ) : | ||
91 | KDialogBase( Plain, caption, User1 | Close, Ok, | ||
92 | parent, caption, true, false, i18n("Import!") ) | ||
93 | { | ||
94 | QHBox * mw = new QHBox( this ); | ||
95 | setMainWidget( mw ); | ||
96 | mListView = new QListView( mw ); | ||
97 | mListView->addColumn(i18n("Select Folder to import")); | ||
98 | mListView->addColumn(i18n("Content Type")); | ||
99 | mABook = aBook; | ||
100 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); | ||
101 | setupFolderView(); | ||
102 | resize( sizeHint().width()+50, sizeHint().height()+50 ); | ||
103 | } | ||
104 | |||
105 | KAImportOLdialog::~KAImportOLdialog() | ||
106 | { | ||
107 | |||
108 | } | ||
109 | |||
110 | KABC::Addressee::List KAImportOLdialog::getAddressList() | ||
111 | { | ||
112 | return mAList; | ||
113 | } | ||
114 | void KAImportOLdialog::setupFolderView() | ||
115 | { | ||
116 | SCODE sc = ::OleInitialize(NULL); | ||
117 | if ( FAILED ( sc ) ) { | ||
118 | KMessageBox::information(this,"OLE initialisation failed"); | ||
119 | return; | ||
120 | } | ||
121 | |||
122 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ | ||
123 | KMessageBox::information(this,"Sorry, cannot access Outlook"); | ||
124 | return ; | ||
125 | } | ||
126 | MAPIFolder mfInbox; | ||
127 | MAPIFolder mfRoot; | ||
128 | CString szName; | ||
129 | _NameSpace olNS; | ||
130 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); | ||
131 | mfInbox = olNS.GetDefaultFolder(6); | ||
132 | mfRoot = mfInbox.GetParent(); | ||
133 | szName = mfRoot.GetName(); | ||
134 | long iType = mfRoot.GetDefaultItemType(); | ||
135 | QString mes; | ||
136 | mes = QString::fromUcs2( szName.GetBuffer() ); | ||
137 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); | ||
138 | mfRoot.m_lpDispatch->AddRef(); | ||
139 | addFolder( root, mfRoot.m_lpDispatch ); | ||
140 | root->setOpen( true ); | ||
141 | mListView->setSortColumn( 0 ); | ||
142 | mListView->sort( ); | ||
143 | } | ||
144 | |||
145 | |||
146 | void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) | ||
147 | { | ||
148 | MAPIFolder mfParent(dispParent), mfChild; | ||
149 | _Folders folders; | ||
150 | _variant_t fndx((long)0); | ||
151 | CString szName; | ||
152 | long iType; | ||
153 | OLEListViewItem* hChild; | ||
154 | |||
155 | folders = mfParent.GetFolders(); | ||
156 | for(int i=1; i <= folders.GetCount(); ++i) | ||
157 | { | ||
158 | fndx = (long)i; | ||
159 | mfChild = folders.Item(fndx.Detach()); | ||
160 | mfChild.m_lpDispatch->AddRef(); | ||
161 | szName = mfChild.GetName(); | ||
162 | iType = mfChild.GetDefaultItemType(); | ||
163 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); | ||
164 | if ( iType != 2) | ||
165 | hChild->setEnabled( false ); | ||
166 | QString ts; | ||
167 | switch( iType ) { | ||
168 | case 0: | ||
169 | ts = i18n("Mail"); | ||
170 | break; | ||
171 | case 1: | ||
172 | ts = i18n("Calendar"); | ||
173 | break; | ||
174 | case 2: | ||
175 | ts = i18n("Contacts"); | ||
176 | break; | ||
177 | case 3: | ||
178 | ts = i18n("Todos"); | ||
179 | break; | ||
180 | case 4: | ||
181 | ts = i18n("Journals"); | ||
182 | break; | ||
183 | case 5: | ||
184 | ts = i18n("Notes"); | ||
185 | break; | ||
186 | default: | ||
187 | ts = i18n("Unknown"); | ||
188 | } | ||
189 | hChild->setText( 1,ts); | ||
190 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); | ||
191 | mfChild.m_lpDispatch->AddRef(); | ||
192 | addFolder(hChild, mfChild.m_lpDispatch); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | void KAImportOLdialog::slotApply() | ||
197 | { | ||
198 | importedItems = 0; | ||
199 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); | ||
200 | while ( child ) { | ||
201 | if ( child->isOn() ) | ||
202 | readContactData( child->data() ); | ||
203 | child = (OLEListViewItem*) child->itemBelow(); | ||
204 | } | ||
205 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); | ||
206 | KMessageBox::information(this,mes); | ||
207 | } | ||
208 | void KAImportOLdialog::readContactData( DWORD folder ) | ||
209 | { | ||
210 | |||
211 | LPDISPATCH dispItem = (LPDISPATCH)folder; | ||
212 | dispItem->AddRef(); | ||
213 | MAPIFolder mf(dispItem); | ||
214 | mf.m_lpDispatch->AddRef(); | ||
215 | _Items folderItems; | ||
216 | _variant_t indx((long)0); | ||
217 | LPDISPATCH itm; | ||
218 | int i; | ||
219 | folderItems = mf.GetItems(); | ||
220 | QProgressBar bar( folderItems.GetCount(),0 ); | ||
221 | bar.setCaption (i18n("Importing - close to abort!") ); | ||
222 | int h = bar.sizeHint().height() ; | ||
223 | int w = 300; | ||
224 | int dw = QApplication::desktop()->width(); | ||
225 | int dh = QApplication::desktop()->height(); | ||
226 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
227 | bar.show(); | ||
228 | for(i=1; i <= folderItems.GetCount(); ++i) | ||
229 | { | ||
230 | qApp->processEvents(); | ||
231 | if ( ! bar.isVisible() ) | ||
232 | return ; | ||
233 | bar.setProgress( i ); | ||
234 | indx = (long)i; | ||
235 | itm = folderItems.Item(indx.Detach()); | ||
236 | _ContactItem * pItem = (_ContactItem *)&itm; | ||
237 | ol2kapiContact( pItem ); | ||
238 | itm->Release(); | ||
239 | } | ||
240 | } | ||
241 | void KAImportOLdialog::slotOk() | ||
242 | { | ||
243 | QDialog::accept(); | ||
244 | } | ||
245 | |||
246 | void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) | ||
247 | { | ||
248 | KABC::Addressee addressee; | ||
249 | |||
250 | addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); | ||
251 | |||
252 | //addressee.setName( const QString &name ); | ||
253 | //addressee.setFormattedName( const QString &formattedName ); | ||
254 | addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); | ||
255 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); | ||
256 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); | ||
257 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); | ||
258 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); | ||
259 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); | ||
260 | QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); | ||
261 | if ( dtb.isValid() ) | ||
262 | addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); | ||
263 | |||
264 | //QString::fromUcs2(aItem->.GetBuffer()) | ||
265 | //addressee.setMailer( const QString &mailer ); | ||
266 | //addressee.setTimeZone( const TimeZone &timeZone ); | ||
267 | //addressee.setGeo( const Geo &geo ); | ||
268 | //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix | ||
269 | addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); | ||
270 | addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) ); | ||
271 | addressee.setNote( QString::fromUcs2(aItem->GetBody().GetBuffer()) ); | ||
272 | |||
273 | addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); | ||
274 | //addressee.setRevision( const QDateTime &revision ); | ||
275 | // addressee.setSortString( const QString &sortString ); | ||
276 | addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); | ||
277 | |||
278 | QString tempS; | ||
279 | tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); | ||
280 | if ( tempS.length() > 12 ) | ||
281 | addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); | ||
282 | tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); | ||
283 | if ( !tempS.isEmpty() ) | ||
284 | addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); | ||
285 | tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); | ||
286 | if ( !tempS.isEmpty() ) | ||
287 | addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); | ||
288 | tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); | ||
289 | if ( !tempS.isEmpty() ) | ||
290 | addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); | ||
291 | tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); | ||
292 | if ( !tempS.isEmpty() ) | ||
293 | addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); | ||
294 | tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()); | ||
295 | if ( !tempS.isEmpty() ) | ||
296 | addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); | ||
297 | tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); | ||
298 | if ( !tempS.isEmpty() ) | ||
299 | addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); | ||
300 | dtb = mDdate2Qdtr(aItem->GetAnniversary()); | ||
301 | if (dtb.isValid() ) { | ||
302 | QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); | ||
303 | addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | ||
304 | } | ||
305 | int sec = aItem->GetSensitivity() ; | ||
306 | if ( sec > 1 )// mapping pers -> private | ||
307 | --sec; | ||
308 | addressee.setSecrecy( sec ); | ||
309 | //addressee.setLogo( const Picture &logo ); | ||
310 | //addressee.setPhoto( const Picture &photo ); | ||
311 | //addressee.setSound( const Sound &sound ); | ||
312 | //addressee.setAgent( const Agent &agent ); | ||
313 | QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); | ||
314 | addressee.setCategories( QStringList::split( ";", cat )); | ||
315 | |||
316 | QString phoneS; | ||
317 | |||
318 | phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); | ||
319 | if ( ! phoneS.isEmpty()) | ||
320 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); | ||
321 | phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); | ||
322 | if ( ! phoneS.isEmpty()) | ||
323 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); | ||
324 | phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); | ||
325 | if ( ! phoneS.isEmpty()) | ||
326 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); | ||
327 | phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer()); | ||
328 | if ( ! phoneS.isEmpty()) | ||
329 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) ); | ||
330 | phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer()); | ||
331 | if ( ! phoneS.isEmpty()) | ||
332 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) ); | ||
333 | phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer()); | ||
334 | if ( ! phoneS.isEmpty()) | ||
335 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); | ||
336 | phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer()); | ||
337 | if ( ! phoneS.isEmpty()) | ||
338 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); | ||
339 | phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer()); | ||
340 | if ( ! phoneS.isEmpty()) | ||
341 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) ); | ||
342 | phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer()); | ||
343 | if ( ! phoneS.isEmpty()) | ||
344 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) ); | ||
345 | phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer()); | ||
346 | if ( ! phoneS.isEmpty()) | ||
347 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) ); | ||
348 | phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer()); | ||
349 | if ( ! phoneS.isEmpty()) | ||
350 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) ); | ||
351 | phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer()); | ||
352 | if ( ! phoneS.isEmpty()) | ||
353 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) ); | ||
354 | phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer()); | ||
355 | if ( ! phoneS.isEmpty()) | ||
356 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) ); | ||
357 | phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer()); | ||
358 | if ( ! phoneS.isEmpty()) | ||
359 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) ); | ||
360 | phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer()); | ||
361 | if ( ! phoneS.isEmpty()) | ||
362 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) ); | ||
363 | phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer()); | ||
364 | if ( ! phoneS.isEmpty()) | ||
365 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) ); | ||
366 | phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer()); | ||
367 | if ( ! phoneS.isEmpty()) | ||
368 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) ); | ||
369 | phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer()); | ||
370 | if ( ! phoneS.isEmpty()) | ||
371 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) ); | ||
372 | phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer()); | ||
373 | if ( ! phoneS.isEmpty()) | ||
374 | addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) ); | ||
375 | |||
376 | bool preferred = true; | ||
377 | phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer()); | ||
378 | if ( ! phoneS.isEmpty()) { | ||
379 | addressee.insertEmail(phoneS , preferred ); | ||
380 | preferred = false; | ||
381 | } | ||
382 | phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer()); | ||
383 | if ( ! phoneS.isEmpty()) { | ||
384 | addressee.insertEmail(phoneS , preferred ); | ||
385 | preferred = false; | ||
386 | } | ||
387 | phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); | ||
388 | if ( ! phoneS.isEmpty()) { | ||
389 | addressee.insertEmail(phoneS , preferred ); | ||
390 | preferred = false; | ||
391 | } | ||
392 | // is this the number of the preferred email? | ||
393 | //long GetSelectedMailingAddress();??? | ||
394 | |||
395 | KABC::Address addressHome; | ||
396 | KABC::Address* addressAdd = &addressHome; | ||
397 | bool insert = false; | ||
398 | phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); | ||
399 | if ( ! phoneS.isEmpty()) { | ||
400 | addressAdd->setCountry(phoneS ); | ||
401 | insert = true; | ||
402 | } | ||
403 | phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); | ||
404 | if ( ! phoneS.isEmpty()) { | ||
405 | addressAdd->setRegion(phoneS ); | ||
406 | insert = true; | ||
407 | } | ||
408 | phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); | ||
409 | if ( ! phoneS.isEmpty()) { | ||
410 | addressAdd->setLocality(phoneS ); | ||
411 | insert = true; | ||
412 | } | ||
413 | phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); | ||
414 | if ( ! phoneS.isEmpty()) { | ||
415 | addressAdd->setPostalCode(phoneS ); | ||
416 | insert = true; | ||
417 | } | ||
418 | phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); | ||
419 | if ( ! phoneS.isEmpty()) { | ||
420 | addressAdd->setPostOfficeBox(phoneS ); | ||
421 | insert = true; | ||
422 | } | ||
423 | phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); | ||
424 | if ( ! phoneS.isEmpty()) { | ||
425 | addressAdd->setStreet(phoneS ); | ||
426 | insert = true; | ||
427 | } | ||
428 | phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); | ||
429 | if ( ! phoneS.isEmpty()) { | ||
430 | // redundant !addressAdd->setExtended(phoneS ); | ||
431 | // insert = true; | ||
432 | } | ||
433 | addressAdd->setType( KABC::Address::Home ); | ||
434 | if ( insert ) | ||
435 | addressee.insertAddress( *addressAdd ); | ||
436 | // ++++++++++++++++++++++ end of address | ||
437 | |||
438 | KABC::Address addressWork; | ||
439 | addressAdd = &addressWork; | ||
440 | insert = false; | ||
441 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); | ||
442 | if ( ! phoneS.isEmpty()) { | ||
443 | addressAdd->setCountry(phoneS ); | ||
444 | insert = true; | ||
445 | } | ||
446 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); | ||
447 | if ( ! phoneS.isEmpty()) { | ||
448 | addressAdd->setRegion(phoneS ); | ||
449 | insert = true; | ||
450 | } | ||
451 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); | ||
452 | if ( ! phoneS.isEmpty()) { | ||
453 | addressAdd->setLocality(phoneS ); | ||
454 | insert = true; | ||
455 | } | ||
456 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); | ||
457 | if ( ! phoneS.isEmpty()) { | ||
458 | addressAdd->setPostalCode(phoneS ); | ||
459 | insert = true; | ||
460 | } | ||
461 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); | ||
462 | if ( ! phoneS.isEmpty()) { | ||
463 | addressAdd->setPostOfficeBox(phoneS ); | ||
464 | insert = true; | ||
465 | } | ||
466 | phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); | ||
467 | if ( ! phoneS.isEmpty()) { | ||
468 | addressAdd->setStreet(phoneS ); | ||
469 | insert = true; | ||
470 | } | ||
471 | phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); | ||
472 | if ( ! phoneS.isEmpty()) { | ||
473 | // redundant !addressAdd->setExtended(phoneS ); | ||
474 | // insert = true; | ||
475 | } | ||
476 | addressAdd->setType( KABC::Address::Work ); | ||
477 | if ( insert ) | ||
478 | addressee.insertAddress( *addressAdd ); | ||
479 | // ++++++++++++++++++++++ end of address | ||
480 | |||
481 | KABC::Address addressOther; | ||
482 | addressAdd = &addressOther; | ||
483 | insert = false; | ||
484 | phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); | ||
485 | if ( ! phoneS.isEmpty()) { | ||
486 | addressAdd->setCountry(phoneS ); | ||
487 | insert = true; | ||
488 | } | ||
489 | phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); | ||
490 | if ( ! phoneS.isEmpty()) { | ||
491 | addressAdd->setRegion(phoneS ); | ||
492 | insert = true; | ||
493 | } | ||
494 | phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); | ||
495 | if ( ! phoneS.isEmpty()) { | ||
496 | addressAdd->setLocality(phoneS ); | ||
497 | insert = true; | ||
498 | } | ||
499 | phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); | ||
500 | if ( ! phoneS.isEmpty()) { | ||
501 | addressAdd->setPostalCode(phoneS ); | ||
502 | insert = true; | ||
503 | } | ||
504 | phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); | ||
505 | if ( ! phoneS.isEmpty()) { | ||
506 | addressAdd->setPostOfficeBox(phoneS ); | ||
507 | insert = true; | ||
508 | } | ||
509 | phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); | ||
510 | if ( ! phoneS.isEmpty()) { | ||
511 | addressAdd->setStreet(phoneS ); | ||
512 | insert = true; | ||
513 | } | ||
514 | phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); | ||
515 | if ( ! phoneS.isEmpty()) { | ||
516 | // redundant !addressAdd->setExtended(phoneS ); | ||
517 | //insert = true; | ||
518 | } | ||
519 | //addressAdd->setId( ); | ||
520 | if ( insert ) | ||
521 | addressee.insertAddress( *addressAdd ); | ||
522 | // ++++++++++++++++++++++ end of address | ||
523 | KABC::Address addressMail; | ||
524 | addressAdd = &addressMail; | ||
525 | insert = false; | ||
526 | phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); | ||
527 | if ( ! phoneS.isEmpty()) { | ||
528 | addressAdd->setCountry(phoneS ); | ||
529 | insert = true; | ||
530 | } | ||
531 | phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); | ||
532 | if ( ! phoneS.isEmpty()) { | ||
533 | addressAdd->setRegion(phoneS ); | ||
534 | insert = true; | ||
535 | } | ||
536 | phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); | ||
537 | if ( ! phoneS.isEmpty()) { | ||
538 | addressAdd->setLocality(phoneS ); | ||
539 | insert = true; | ||
540 | } | ||
541 | phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); | ||
542 | if ( ! phoneS.isEmpty()) { | ||
543 | addressAdd->setPostalCode(phoneS ); | ||
544 | insert = true; | ||
545 | } | ||
546 | phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); | ||
547 | if ( ! phoneS.isEmpty()) { | ||
548 | addressAdd->setPostOfficeBox(phoneS ); | ||
549 | insert = true; | ||
550 | } | ||
551 | phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); | ||
552 | if ( ! phoneS.isEmpty()) { | ||
553 | addressAdd->setStreet(phoneS ); | ||
554 | insert = true; | ||
555 | } | ||
556 | phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); | ||
557 | if ( ! phoneS.isEmpty()) { | ||
558 | // redundant ! addressAdd->setExtended(phoneS ); | ||
559 | // insert = true; | ||
560 | } | ||
561 | addressAdd->setType( KABC::Address::Postal ); | ||
562 | if ( insert ) { | ||
563 | addressee.insertAddress( *addressAdd ); | ||
564 | } | ||
565 | // the following code is disabled | ||
566 | // it does not seem to be useful | ||
567 | #if 0 | ||
568 | if ( insert ) { | ||
569 | addressAdd->setType( KABC::Address::Home ); | ||
570 | if ( addressMail == addressHome ) { | ||
571 | addressHome.setType( KABC::Address::Postal+ KABC::Address::Home ); | ||
572 | addressee.insertAddress( addressHome ); | ||
573 | } else { | ||
574 | addressAdd->setType( KABC::Address::Work ); | ||
575 | if ( addressMail == addressWork ){ | ||
576 | addressWork.setType( KABC::Address::Postal+ KABC::Address::Work ); | ||
577 | addressee.insertAddress( addressWork ); | ||
578 | |||
579 | } else { | ||
580 | addressAdd->setType( 0 ); | ||
581 | if ( addressOther == addressMail ){ | ||
582 | addressOther.setType( KABC::Address::Postal ); | ||
583 | addressee.insertAddress( addressOther ); | ||
584 | } else { | ||
585 | addressee.insertAddress( *addressAdd ); | ||
586 | } | ||
587 | } | ||
588 | } | ||
589 | } | ||
590 | #endif | ||
591 | // ++++++++++++++++++++++ end of ALL addresses | ||
592 | //GetUserProperties(); | ||
593 | tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); | ||
594 | if ( !tempS.isEmpty() ) | ||
595 | addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); | ||
596 | tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); | ||
597 | if ( !tempS.isEmpty() ) | ||
598 | addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); | ||
599 | int gen = aItem->GetGender(); | ||
600 | if ( gen != 0 ) { // 0 undef - 1 female - 2 male | ||
601 | if ( gen == 1 ) | ||
602 | addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); | ||
603 | else | ||
604 | addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); | ||
605 | } | ||
606 | |||
607 | #if 0 | ||
608 | // pending | ||
609 | - IM address: no clue where to get info about the helper ID | ||
610 | -custom fields: difficult to implement - not implemented | ||
611 | -keys: makes no sense | ||
612 | #endif | ||
613 | |||
614 | if ( addAddressee( addressee )) | ||
615 | ++importedItems; | ||
616 | } | ||
617 | void KAImportOLdialog::slotCancel() | ||
618 | { | ||
619 | reject(); | ||
620 | } | ||
621 | |||
622 | bool KAImportOLdialog::addAddressee( KABC::Addressee a ) | ||
623 | { | ||
624 | bool add = true; | ||
625 | KABC::Addressee::List::Iterator it; | ||
626 | for ( it = mAList.begin(); it != mAList.end(); ++it ) { | ||
627 | if ( (*it).uid() == a.uid() ) { | ||
628 | add = false; | ||
629 | break; | ||
630 | } | ||
631 | } | ||
632 | if ( add ) | ||
633 | mAList.append ( a ); | ||
634 | return add; | ||
635 | } | ||
diff --git a/kaddressbook/kaimportoldialog.h b/kaddressbook/kaimportoldialog.h new file mode 100644 index 0000000..41ea5f8 --- a/dev/null +++ b/kaddressbook/kaimportoldialog.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef KOINCIDENCEEDITOR_H | ||
24 | #define KOINCIDENCEEDITOR_H | ||
25 | |||
26 | #include <kdialogbase.h> | ||
27 | |||
28 | #include <afxdisp.h> | ||
29 | |||
30 | #include <kabc/addressee.h> | ||
31 | #include <kabc/addressbook.h> | ||
32 | |||
33 | class QDateTime; | ||
34 | class QListView; | ||
35 | class OLEListViewItem; | ||
36 | class _ContactItem; | ||
37 | |||
38 | |||
39 | //using namespace KABC; | ||
40 | //class KABC::AddressBook; | ||
41 | |||
42 | /** | ||
43 | This is the base class for the calendar component editors. | ||
44 | */ | ||
45 | class KAImportOLdialog : public KDialogBase | ||
46 | { | ||
47 | Q_OBJECT | ||
48 | public: | ||
49 | /** | ||
50 | Construct new IncidenceEditor. | ||
51 | */ | ||
52 | KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook, | ||
53 | QWidget *parent ); | ||
54 | ~KAImportOLdialog(); | ||
55 | |||
56 | /** Initialize editor. This function creates the tab widgets. */ | ||
57 | void init(); | ||
58 | KABC::Addressee::List getAddressList(); | ||
59 | public slots: | ||
60 | |||
61 | |||
62 | signals: | ||
63 | |||
64 | protected slots: | ||
65 | void slotApply(); | ||
66 | void slotOk(); | ||
67 | void slotCancel(); | ||
68 | |||
69 | protected: | ||
70 | void setupFolderView(); | ||
71 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent); | ||
72 | void readContactData( DWORD folder ); | ||
73 | void ol2kapiContact( _ContactItem * ); | ||
74 | |||
75 | KABC::AddressBook * mABook; | ||
76 | QListView * mListView; | ||
77 | KABC::Addressee::List mAList; | ||
78 | bool addAddressee( KABC::Addressee a ); | ||
79 | private: | ||
80 | int importedItems; | ||
81 | }; | ||
82 | |||
83 | #endif | ||
84 | |||
85 | |||