-rw-r--r-- | kaddressbook/kabcore.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 1a34e4d..8daca33 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -70,193 +70,194 @@ | |||
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_ | 113 | #ifdef _WIN32_ |
114 | 114 | ||
115 | #include "kaimportoldialog.h" | 115 | #include "kaimportoldialog.h" |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | bool pasteWithNewUid = true; | 118 | bool pasteWithNewUid = true; |
119 | 119 | ||
120 | #ifdef KAB_EMBEDDED | 120 | #ifdef KAB_EMBEDDED |
121 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 121 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
122 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 122 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
123 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 123 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
124 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 124 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
125 | #else //KAB_EMBEDDED | 125 | #else //KAB_EMBEDDED |
126 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 126 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
127 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 127 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
128 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 128 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
129 | mReadWrite( readWrite ), mModified( false ) | 129 | mReadWrite( readWrite ), mModified( false ) |
130 | #endif //KAB_EMBEDDED | 130 | #endif //KAB_EMBEDDED |
131 | { | 131 | { |
132 | #ifdef KAB_EMBEDDED | 132 | #ifdef KAB_EMBEDDED |
133 | //US we define here our own global actioncollection. | 133 | //US we define here our own global actioncollection. |
134 | //mActionCollection = new KActionCollection(this); | 134 | //mActionCollection = new KActionCollection(this); |
135 | #endif //KAB_EMBEDDED | 135 | #endif //KAB_EMBEDDED |
136 | mExtensionBarSplitter = 0; | 136 | mExtensionBarSplitter = 0; |
137 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 137 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
138 | 138 | ||
139 | mAddressBook = KABC::StdAddressBook::self(); | 139 | mAddressBook = KABC::StdAddressBook::self(); |
140 | KABC::StdAddressBook::setAutomaticSave( false ); | 140 | KABC::StdAddressBook::setAutomaticSave( false ); |
141 | 141 | ||
142 | #ifndef KAB_EMBEDDED | 142 | #ifndef KAB_EMBEDDED |
143 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 143 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
144 | #endif //KAB_EMBEDDED | 144 | #endif //KAB_EMBEDDED |
145 | 145 | ||
146 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 146 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
147 | SLOT( addressBookChanged() ) ); | 147 | SLOT( addressBookChanged() ) ); |
148 | 148 | ||
149 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 149 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
150 | "X-Department", "KADDRESSBOOK" ); | 150 | "X-Department", "KADDRESSBOOK" ); |
151 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 151 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
152 | "X-Profession", "KADDRESSBOOK" ); | 152 | "X-Profession", "KADDRESSBOOK" ); |
153 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 153 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
154 | "X-AssistantsName", "KADDRESSBOOK" ); | 154 | "X-AssistantsName", "KADDRESSBOOK" ); |
155 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 155 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
156 | "X-ManagersName", "KADDRESSBOOK" ); | 156 | "X-ManagersName", "KADDRESSBOOK" ); |
157 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 157 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
158 | "X-SpousesName", "KADDRESSBOOK" ); | 158 | "X-SpousesName", "KADDRESSBOOK" ); |
159 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 159 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
160 | "X-Office", "KADDRESSBOOK" ); | 160 | "X-Office", "KADDRESSBOOK" ); |
161 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 161 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
162 | "X-IMAddress", "KADDRESSBOOK" ); | 162 | "X-IMAddress", "KADDRESSBOOK" ); |
163 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 163 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
164 | "X-Anniversary", "KADDRESSBOOK" ); | 164 | "X-Anniversary", "KADDRESSBOOK" ); |
165 | 165 | ||
166 | //US added this field to become compatible with Opie addressbook | 166 | //US added this field to become compatible with Opie/qtopia addressbook |
167 | // values can be "female" or "male" or "". An empty field represents undefined. | ||
167 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 168 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
168 | "X-Gender", "KADDRESSBOOK" ); | 169 | "X-Gender", "KADDRESSBOOK" ); |
169 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 170 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
170 | "X-Children", "KADDRESSBOOK" ); | 171 | "X-Children", "KADDRESSBOOK" ); |
171 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 172 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
172 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 173 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
173 | 174 | ||
174 | initGUI(); | 175 | initGUI(); |
175 | 176 | ||
176 | mIncSearchWidget->setFocus(); | 177 | mIncSearchWidget->setFocus(); |
177 | 178 | ||
178 | 179 | ||
179 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 180 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
180 | SLOT( setContactSelected( const QString& ) ) ); | 181 | SLOT( setContactSelected( const QString& ) ) ); |
181 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 182 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
182 | SLOT( editContact( const QString& ) ) ); | 183 | SLOT( editContact( const QString& ) ) ); |
183 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 184 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
184 | SLOT( deleteContacts( ) ) ); | 185 | SLOT( deleteContacts( ) ) ); |
185 | connect( mViewManager, SIGNAL( modified() ), | 186 | connect( mViewManager, SIGNAL( modified() ), |
186 | SLOT( setModified() ) ); | 187 | SLOT( setModified() ) ); |
187 | 188 | ||
188 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 189 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
189 | 190 | ||
190 | connect( mXXPortManager, SIGNAL( modified() ), | 191 | connect( mXXPortManager, SIGNAL( modified() ), |
191 | SLOT( setModified() ) ); | 192 | SLOT( setModified() ) ); |
192 | 193 | ||
193 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 194 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
194 | SLOT( incrementalSearch( const QString& ) ) ); | 195 | SLOT( incrementalSearch( const QString& ) ) ); |
195 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 196 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
196 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 197 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
197 | 198 | ||
198 | #ifndef KAB_EMBEDDED | 199 | #ifndef KAB_EMBEDDED |
199 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 200 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
200 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 201 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
201 | 202 | ||
202 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 203 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
203 | SLOT( sendMail( const QString& ) ) ); | 204 | SLOT( sendMail( const QString& ) ) ); |
204 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 205 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
205 | SLOT( browse( const QString& ) ) ); | 206 | SLOT( browse( const QString& ) ) ); |
206 | 207 | ||
207 | mAddressBookService = new KAddressBookService( this ); | 208 | mAddressBookService = new KAddressBookService( this ); |
208 | 209 | ||
209 | #endif //KAB_EMBEDDED | 210 | #endif //KAB_EMBEDDED |
210 | mEditorDialog = 0; | 211 | mEditorDialog = 0; |
211 | createAddresseeEditorDialog( this ); | 212 | createAddresseeEditorDialog( this ); |
212 | setModified( false ); | 213 | setModified( false ); |
213 | } | 214 | } |
214 | 215 | ||
215 | KABCore::~KABCore() | 216 | KABCore::~KABCore() |
216 | { | 217 | { |
217 | // save(); | 218 | // save(); |
218 | //saveSettings(); | 219 | //saveSettings(); |
219 | //KABPrefs::instance()->writeConfig(); | 220 | //KABPrefs::instance()->writeConfig(); |
220 | delete AddresseeConfig::instance(); | 221 | delete AddresseeConfig::instance(); |
221 | mAddressBook = 0; | 222 | mAddressBook = 0; |
222 | KABC::StdAddressBook::close(); | 223 | KABC::StdAddressBook::close(); |
223 | 224 | ||
224 | #ifdef KAB_EMBEDDED | 225 | #ifdef KAB_EMBEDDED |
225 | //US we define here our own global actioncollection. | 226 | //US we define here our own global actioncollection. |
226 | // delete mActionCollection; | 227 | // delete mActionCollection; |
227 | #endif //KAB_EMBEDDED | 228 | #endif //KAB_EMBEDDED |
228 | 229 | ||
229 | } | 230 | } |
230 | 231 | ||
231 | void KABCore::restoreSettings() | 232 | void KABCore::restoreSettings() |
232 | { | 233 | { |
233 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 234 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
234 | 235 | ||
235 | mActionJumpBar->setChecked( state ); | 236 | mActionJumpBar->setChecked( state ); |
236 | setJumpButtonBarVisible( state ); | 237 | setJumpButtonBarVisible( state ); |
237 | 238 | ||
238 | state = KABPrefs::instance()->mDetailsPageVisible; | 239 | state = KABPrefs::instance()->mDetailsPageVisible; |
239 | 240 | ||
240 | mActionDetails->setChecked( state ); | 241 | mActionDetails->setChecked( state ); |
241 | setDetailsVisible( state ); | 242 | setDetailsVisible( state ); |
242 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 243 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
243 | if ( splitterSize.count() == 0 ) { | 244 | if ( splitterSize.count() == 0 ) { |
244 | splitterSize.append( width() / 2 ); | 245 | splitterSize.append( width() / 2 ); |
245 | splitterSize.append( width() / 2 ); | 246 | splitterSize.append( width() / 2 ); |
246 | } | 247 | } |
247 | mMiniSplitter->setSizes( splitterSize ); | 248 | mMiniSplitter->setSizes( splitterSize ); |
248 | if ( mExtensionBarSplitter ) { | 249 | if ( mExtensionBarSplitter ) { |
249 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 250 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
250 | if ( splitterSize.count() == 0 ) { | 251 | if ( splitterSize.count() == 0 ) { |
251 | splitterSize.append( width() / 2 ); | 252 | splitterSize.append( width() / 2 ); |
252 | splitterSize.append( width() / 2 ); | 253 | splitterSize.append( width() / 2 ); |
253 | } | 254 | } |
254 | mExtensionBarSplitter->setSizes( splitterSize ); | 255 | mExtensionBarSplitter->setSizes( splitterSize ); |
255 | 256 | ||
256 | } | 257 | } |
257 | #ifndef KAB_EMBEDDED | 258 | #ifndef KAB_EMBEDDED |
258 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 259 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
259 | if ( splitterSize.count() == 0 ) { | 260 | if ( splitterSize.count() == 0 ) { |
260 | splitterSize.append( width() / 2 ); | 261 | splitterSize.append( width() / 2 ); |
261 | splitterSize.append( width() / 2 ); | 262 | splitterSize.append( width() / 2 ); |
262 | } | 263 | } |