-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 3650b20..1433568 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -173,385 +173,385 @@ class KABCatPrefs : public QDialog | |||
173 | QDialog( parent, name, true ) | 173 | QDialog( parent, name, true ) |
174 | { | 174 | { |
175 | setCaption( i18n("Manage new Categories") ); | 175 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 176 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 177 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 178 | lay->setMargin( 3 ); |
179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
180 | lay->addWidget( lab ); | 180 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 182 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 183 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from addressees"), format ); | 185 | new QRadioButton(i18n("Remove from addressees"), format ); |
186 | addCatBut->setChecked( true ); | 186 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 188 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 190 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 193 | resize( 200, 200 ); |
194 | } | 194 | } |
195 | 195 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 196 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 197 | private: |
198 | QRadioButton* addCatBut; | 198 | QRadioButton* addCatBut; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | class KABFormatPrefs : public QDialog | 201 | class KABFormatPrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Set formatted name") ); | 207 | setCaption( i18n("Set formatted name") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
212 | lay->addWidget( lab ); | 212 | lay->addWidget( lab ); |
213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); |
214 | lay->addWidget( format ); | 214 | lay->addWidget( format ); |
215 | format->setExclusive ( true ) ; | 215 | format->setExclusive ( true ) ; |
216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
219 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 219 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
220 | simple->setChecked( true ); | 220 | simple->setChecked( true ); |
221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
222 | lay->addWidget( setCompany ); | 222 | lay->addWidget( setCompany ); |
223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
224 | lay->addWidget( ok ); | 224 | lay->addWidget( ok ); |
225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
226 | lay->addWidget( cancel ); | 226 | lay->addWidget( cancel ); |
227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
229 | //resize( 200, 200 ); | 229 | //resize( 200, 200 ); |
230 | 230 | ||
231 | } | 231 | } |
232 | public: | 232 | public: |
233 | QRadioButton* simple, *full, *reverse, *company; | 233 | QRadioButton* simple, *full, *reverse, *company; |
234 | QCheckBox* setCompany; | 234 | QCheckBox* setCompany; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | 238 | ||
239 | class KAex2phonePrefs : public QDialog | 239 | class KAex2phonePrefs : public QDialog |
240 | { | 240 | { |
241 | public: | 241 | public: |
242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
243 | QDialog( parent, name, true ) | 243 | QDialog( parent, name, true ) |
244 | { | 244 | { |
245 | setCaption( i18n("Export to phone options") ); | 245 | setCaption( i18n("Export to phone options") ); |
246 | QVBoxLayout* lay = new QVBoxLayout( this ); | 246 | QVBoxLayout* lay = new QVBoxLayout( this ); |
247 | lay->setSpacing( 3 ); | 247 | lay->setSpacing( 3 ); |
248 | lay->setMargin( 3 ); | 248 | lay->setMargin( 3 ); |
249 | QLabel *lab; | 249 | QLabel *lab; |
250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
251 | lab->setAlignment (AlignHCenter ); | 251 | lab->setAlignment (AlignHCenter ); |
252 | QHBox* temphb; | 252 | QHBox* temphb; |
253 | temphb = new QHBox( this ); | 253 | temphb = new QHBox( this ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 254 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 255 | mPhoneDevice = new QLineEdit( temphb); |
256 | lay->addWidget( temphb ); | 256 | lay->addWidget( temphb ); |
257 | temphb = new QHBox( this ); | 257 | temphb = new QHBox( this ); |
258 | new QLabel( i18n("Connection: "), temphb ); | 258 | new QLabel( i18n("Connection: "), temphb ); |
259 | mPhoneConnection = new QLineEdit( temphb); | 259 | mPhoneConnection = new QLineEdit( temphb); |
260 | lay->addWidget( temphb ); | 260 | lay->addWidget( temphb ); |
261 | temphb = new QHBox( this ); | 261 | temphb = new QHBox( this ); |
262 | new QLabel( i18n("Model(opt.): "), temphb ); | 262 | new QLabel( i18n("Model(opt.): "), temphb ); |
263 | mPhoneModel = new QLineEdit( temphb); | 263 | mPhoneModel = new QLineEdit( temphb); |
264 | lay->addWidget( temphb ); | 264 | lay->addWidget( temphb ); |
265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
266 | // lay->addWidget( mWriteToSim ); | 266 | // lay->addWidget( mWriteToSim ); |
267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
268 | lab->setAlignment (AlignHCenter); | 268 | lab->setAlignment (AlignHCenter); |
269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
270 | lay->addWidget( ok ); | 270 | lay->addWidget( ok ); |
271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
272 | lay->addWidget( cancel ); | 272 | lay->addWidget( cancel ); |
273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
275 | resize( 220, 240 ); | 275 | resize( 220, 240 ); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | public: | 279 | public: |
280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
281 | QCheckBox* mWriteToSim; | 281 | QCheckBox* mWriteToSim; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | 284 | ||
285 | bool pasteWithNewUid = true; | 285 | bool pasteWithNewUid = true; |
286 | 286 | ||
287 | #ifdef KAB_EMBEDDED | 287 | #ifdef KAB_EMBEDDED |
288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
292 | #else //KAB_EMBEDDED | 292 | #else //KAB_EMBEDDED |
293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
296 | mReadWrite( readWrite ), mModified( false ) | 296 | mReadWrite( readWrite ), mModified( false ) |
297 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
298 | { | 298 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 300 | // syncManager->setBlockSave(false); |
301 | mIncSearchWidget = 0; | 301 | mIncSearchWidget = 0; |
302 | mMiniSplitter = 0; | 302 | mMiniSplitter = 0; |
303 | mExtensionBarSplitter = 0; | 303 | mExtensionBarSplitter = 0; |
304 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 304 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
305 | mAddressBook = KABC::StdAddressBook::self(); | 305 | mAddressBook = KABC::StdAddressBook::self(); |
306 | KABC::StdAddressBook::setAutomaticSave( false ); | 306 | KABC::StdAddressBook::setAutomaticSave( false ); |
307 | 307 | ||
308 | #ifndef KAB_EMBEDDED | 308 | #ifndef KAB_EMBEDDED |
309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
310 | #endif //KAB_EMBEDDED | 310 | #endif //KAB_EMBEDDED |
311 | 311 | ||
312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
313 | SLOT( addressBookChanged() ) ); | 313 | SLOT( addressBookChanged() ) ); |
314 | 314 | ||
315 | #if 0 | 315 | #if 0 |
316 | // LR moved to addressbook init method | 316 | // LR moved to addressbook init method |
317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
318 | "X-Department", "KADDRESSBOOK" ); | 318 | "X-Department", "KADDRESSBOOK" ); |
319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
320 | "X-Profession", "KADDRESSBOOK" ); | 320 | "X-Profession", "KADDRESSBOOK" ); |
321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
322 | "X-AssistantsName", "KADDRESSBOOK" ); | 322 | "X-AssistantsName", "KADDRESSBOOK" ); |
323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
324 | "X-ManagersName", "KADDRESSBOOK" ); | 324 | "X-ManagersName", "KADDRESSBOOK" ); |
325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
326 | "X-SpousesName", "KADDRESSBOOK" ); | 326 | "X-SpousesName", "KADDRESSBOOK" ); |
327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
328 | "X-Office", "KADDRESSBOOK" ); | 328 | "X-Office", "KADDRESSBOOK" ); |
329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
330 | "X-IMAddress", "KADDRESSBOOK" ); | 330 | "X-IMAddress", "KADDRESSBOOK" ); |
331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
332 | "X-Anniversary", "KADDRESSBOOK" ); | 332 | "X-Anniversary", "KADDRESSBOOK" ); |
333 | 333 | ||
334 | //US added this field to become compatible with Opie/qtopia addressbook | 334 | //US added this field to become compatible with Opie/qtopia addressbook |
335 | // values can be "female" or "male" or "". An empty field represents undefined. | 335 | // values can be "female" or "male" or "". An empty field represents undefined. |
336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
337 | "X-Gender", "KADDRESSBOOK" ); | 337 | "X-Gender", "KADDRESSBOOK" ); |
338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
339 | "X-Children", "KADDRESSBOOK" ); | 339 | "X-Children", "KADDRESSBOOK" ); |
340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
342 | #endif | 342 | #endif |
343 | initGUI(); | 343 | initGUI(); |
344 | 344 | ||
345 | mIncSearchWidget->setFocus(); | 345 | mIncSearchWidget->setFocus(); |
346 | 346 | ||
347 | 347 | ||
348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
349 | SLOT( setContactSelected( const QString& ) ) ); | 349 | SLOT( setContactSelected( const QString& ) ) ); |
350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
351 | SLOT( executeContact( const QString& ) ) ); | 351 | SLOT( executeContact( const QString& ) ) ); |
352 | 352 | ||
353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
354 | SLOT( deleteContacts( ) ) ); | 354 | SLOT( deleteContacts( ) ) ); |
355 | connect( mViewManager, SIGNAL( modified() ), | 355 | connect( mViewManager, SIGNAL( modified() ), |
356 | SLOT( setModified() ) ); | 356 | SLOT( setModified() ) ); |
357 | 357 | ||
358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
360 | 360 | ||
361 | connect( mXXPortManager, SIGNAL( modified() ), | 361 | connect( mXXPortManager, SIGNAL( modified() ), |
362 | SLOT( setModified() ) ); | 362 | SLOT( setModified() ) ); |
363 | 363 | ||
364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
365 | SLOT( incrementalSearch( const QString& ) ) ); | 365 | SLOT( incrementalSearchJump( const QString& ) ) ); |
366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
367 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 367 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
368 | 368 | ||
369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
370 | SLOT( sendMail( const QString& ) ) ); | 370 | SLOT( sendMail( const QString& ) ) ); |
371 | 371 | ||
372 | 372 | ||
373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); | 377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); |
378 | 378 | ||
379 | 379 | ||
380 | #ifndef KAB_EMBEDDED | 380 | #ifndef KAB_EMBEDDED |
381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
383 | 383 | ||
384 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 384 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
385 | SLOT( browse( const QString& ) ) ); | 385 | SLOT( browse( const QString& ) ) ); |
386 | 386 | ||
387 | 387 | ||
388 | mAddressBookService = new KAddressBookService( this ); | 388 | mAddressBookService = new KAddressBookService( this ); |
389 | 389 | ||
390 | #endif //KAB_EMBEDDED | 390 | #endif //KAB_EMBEDDED |
391 | 391 | ||
392 | mMessageTimer = new QTimer( this ); | 392 | mMessageTimer = new QTimer( this ); |
393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
394 | mEditorDialog = 0; | 394 | mEditorDialog = 0; |
395 | createAddresseeEditorDialog( this ); | 395 | createAddresseeEditorDialog( this ); |
396 | setModified( false ); | 396 | setModified( false ); |
397 | mBRdisabled = false; | 397 | mBRdisabled = false; |
398 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
399 | infrared = 0; | 399 | infrared = 0; |
400 | #endif | 400 | #endif |
401 | //toggleBeamReceive( ); | 401 | //toggleBeamReceive( ); |
402 | //mMainWindow->toolBar()->show(); | 402 | //mMainWindow->toolBar()->show(); |
403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
405 | } | 405 | } |
406 | 406 | ||
407 | void KABCore::updateToolBar() | 407 | void KABCore::updateToolBar() |
408 | { | 408 | { |
409 | static int iii = 0; | 409 | static int iii = 0; |
410 | ++iii; | 410 | ++iii; |
411 | mMainWindow->toolBar()->repaintMe(); | 411 | mMainWindow->toolBar()->repaintMe(); |
412 | if ( iii < 4 ) | 412 | if ( iii < 4 ) |
413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
414 | } | 414 | } |
415 | KABCore::~KABCore() | 415 | KABCore::~KABCore() |
416 | { | 416 | { |
417 | // save(); | 417 | // save(); |
418 | //saveSettings(); | 418 | //saveSettings(); |
419 | //KABPrefs::instance()->writeConfig(); | 419 | //KABPrefs::instance()->writeConfig(); |
420 | delete AddresseeConfig::instance(); | 420 | delete AddresseeConfig::instance(); |
421 | mAddressBook = 0; | 421 | mAddressBook = 0; |
422 | KABC::StdAddressBook::close(); | 422 | KABC::StdAddressBook::close(); |
423 | 423 | ||
424 | delete syncManager; | 424 | delete syncManager; |
425 | #ifndef DESKTOP_VERSION | 425 | #ifndef DESKTOP_VERSION |
426 | if ( infrared ) | 426 | if ( infrared ) |
427 | delete infrared; | 427 | delete infrared; |
428 | #endif | 428 | #endif |
429 | } | 429 | } |
430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
431 | { | 431 | { |
432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
433 | if ( cmsg == "setDocument(QString)" ) { | 433 | if ( cmsg == "setDocument(QString)" ) { |
434 | QDataStream stream( data, IO_ReadOnly ); | 434 | QDataStream stream( data, IO_ReadOnly ); |
435 | QString fileName; | 435 | QString fileName; |
436 | stream >> fileName; | 436 | stream >> fileName; |
437 | recieve( fileName ); | 437 | recieve( fileName ); |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | void KABCore::toggleBeamReceive( ) | 441 | void KABCore::toggleBeamReceive( ) |
442 | { | 442 | { |
443 | if ( mBRdisabled ) | 443 | if ( mBRdisabled ) |
444 | return; | 444 | return; |
445 | #ifndef DESKTOP_VERSION | 445 | #ifndef DESKTOP_VERSION |
446 | if ( infrared ) { | 446 | if ( infrared ) { |
447 | qDebug("KA: AB disable BeamReceive "); | 447 | qDebug("KA: AB disable BeamReceive "); |
448 | delete infrared; | 448 | delete infrared; |
449 | infrared = 0; | 449 | infrared = 0; |
450 | mActionBR->setChecked(false); | 450 | mActionBR->setChecked(false); |
451 | return; | 451 | return; |
452 | } | 452 | } |
453 | qDebug("KA: AB enable BeamReceive "); | 453 | qDebug("KA: AB enable BeamReceive "); |
454 | mActionBR->setChecked(true); | 454 | mActionBR->setChecked(true); |
455 | 455 | ||
456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
458 | #endif | 458 | #endif |
459 | } | 459 | } |
460 | 460 | ||
461 | 461 | ||
462 | void KABCore::disableBR(bool b) | 462 | void KABCore::disableBR(bool b) |
463 | { | 463 | { |
464 | #ifndef DESKTOP_VERSION | 464 | #ifndef DESKTOP_VERSION |
465 | if ( b ) { | 465 | if ( b ) { |
466 | if ( infrared ) { | 466 | if ( infrared ) { |
467 | toggleBeamReceive( ); | 467 | toggleBeamReceive( ); |
468 | } | 468 | } |
469 | mBRdisabled = true; | 469 | mBRdisabled = true; |
470 | } else { | 470 | } else { |
471 | if ( mBRdisabled ) { | 471 | if ( mBRdisabled ) { |
472 | mBRdisabled = false; | 472 | mBRdisabled = false; |
473 | //toggleBeamReceive( ); | 473 | //toggleBeamReceive( ); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | #endif | 476 | #endif |
477 | 477 | ||
478 | } | 478 | } |
479 | void KABCore::recieve( QString fn ) | 479 | void KABCore::recieve( QString fn ) |
480 | { | 480 | { |
481 | //qDebug("KABCore::recieve "); | 481 | //qDebug("KABCore::recieve "); |
482 | int count = mAddressBook->importFromFile( fn, true ); | 482 | int count = mAddressBook->importFromFile( fn, true ); |
483 | if ( count ) | 483 | if ( count ) |
484 | setModified( true ); | 484 | setModified( true ); |
485 | mViewManager->refreshView(); | 485 | mViewManager->refreshView(); |
486 | message(i18n("%1 contact(s) received!").arg( count )); | 486 | message(i18n("%1 contact(s) received!").arg( count )); |
487 | topLevelWidget()->showMaximized(); | 487 | topLevelWidget()->showMaximized(); |
488 | topLevelWidget()->raise(); | 488 | topLevelWidget()->raise(); |
489 | } | 489 | } |
490 | void KABCore::restoreSettings() | 490 | void KABCore::restoreSettings() |
491 | { | 491 | { |
492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
493 | 493 | ||
494 | bool state; | 494 | bool state; |
495 | 495 | ||
496 | if (mMultipleViewsAtOnce) | 496 | if (mMultipleViewsAtOnce) |
497 | state = KABPrefs::instance()->mDetailsPageVisible; | 497 | state = KABPrefs::instance()->mDetailsPageVisible; |
498 | else | 498 | else |
499 | state = false; | 499 | state = false; |
500 | 500 | ||
501 | mActionDetails->setChecked( state ); | 501 | mActionDetails->setChecked( state ); |
502 | setDetailsVisible( state ); | 502 | setDetailsVisible( state ); |
503 | 503 | ||
504 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 504 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
505 | 505 | ||
506 | mActionJumpBar->setChecked( state ); | 506 | mActionJumpBar->setChecked( state ); |
507 | setJumpButtonBarVisible( state ); | 507 | setJumpButtonBarVisible( state ); |
508 | /*US | 508 | /*US |
509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
510 | if ( splitterSize.count() == 0 ) { | 510 | if ( splitterSize.count() == 0 ) { |
511 | splitterSize.append( width() / 2 ); | 511 | splitterSize.append( width() / 2 ); |
512 | splitterSize.append( width() / 2 ); | 512 | splitterSize.append( width() / 2 ); |
513 | } | 513 | } |
514 | mMiniSplitter->setSizes( splitterSize ); | 514 | mMiniSplitter->setSizes( splitterSize ); |
515 | if ( mExtensionBarSplitter ) { | 515 | if ( mExtensionBarSplitter ) { |
516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
517 | if ( splitterSize.count() == 0 ) { | 517 | if ( splitterSize.count() == 0 ) { |
518 | splitterSize.append( width() / 2 ); | 518 | splitterSize.append( width() / 2 ); |
519 | splitterSize.append( width() / 2 ); | 519 | splitterSize.append( width() / 2 ); |
520 | } | 520 | } |
521 | mExtensionBarSplitter->setSizes( splitterSize ); | 521 | mExtensionBarSplitter->setSizes( splitterSize ); |
522 | 522 | ||
523 | } | 523 | } |
524 | */ | 524 | */ |
525 | mViewManager->restoreSettings(); | 525 | mViewManager->restoreSettings(); |
526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
527 | mExtensionManager->restoreSettings(); | 527 | mExtensionManager->restoreSettings(); |
528 | #ifdef DESKTOP_VERSION | 528 | #ifdef DESKTOP_VERSION |
529 | int wid = width(); | 529 | int wid = width(); |
530 | if ( wid < 10 ) | 530 | if ( wid < 10 ) |
531 | wid = 400; | 531 | wid = 400; |
532 | #else | 532 | #else |
533 | int wid = QApplication::desktop()->width(); | 533 | int wid = QApplication::desktop()->width(); |
534 | if ( wid < 640 ) | 534 | if ( wid < 640 ) |
535 | wid = QApplication::desktop()->height(); | 535 | wid = QApplication::desktop()->height(); |
536 | #endif | 536 | #endif |
537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
538 | if ( true /*splitterSize.count() == 0*/ ) { | 538 | if ( true /*splitterSize.count() == 0*/ ) { |
539 | splitterSize.append( wid / 2 ); | 539 | splitterSize.append( wid / 2 ); |
540 | splitterSize.append( wid / 2 ); | 540 | splitterSize.append( wid / 2 ); |
541 | } | 541 | } |
542 | mMiniSplitter->setSizes( splitterSize ); | 542 | mMiniSplitter->setSizes( splitterSize ); |
543 | if ( mExtensionBarSplitter ) { | 543 | if ( mExtensionBarSplitter ) { |
544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
545 | if ( true /*splitterSize.count() == 0*/ ) { | 545 | if ( true /*splitterSize.count() == 0*/ ) { |
546 | splitterSize.append( wid / 2 ); | 546 | splitterSize.append( wid / 2 ); |
547 | splitterSize.append( wid / 2 ); | 547 | splitterSize.append( wid / 2 ); |
548 | } | 548 | } |
549 | mExtensionBarSplitter->setSizes( splitterSize ); | 549 | mExtensionBarSplitter->setSizes( splitterSize ); |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | ||
553 | 553 | ||
554 | } | 554 | } |
555 | 555 | ||
556 | void KABCore::saveSettings() | 556 | void KABCore::saveSettings() |
557 | { | 557 | { |
@@ -984,384 +984,388 @@ void KABCore::beamVCard(const QStringList& uids) | |||
984 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 984 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
985 | t.setEncoding( QTextStream::Latin1 ); | 985 | t.setEncoding( QTextStream::Latin1 ); |
986 | t <<datastream.latin1(); | 986 | t <<datastream.latin1(); |
987 | outFile.close(); | 987 | outFile.close(); |
988 | Ir *ir = new Ir( this ); | 988 | Ir *ir = new Ir( this ); |
989 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 989 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
990 | ir->send( fileName, description, "text/x-vCard" ); | 990 | ir->send( fileName, description, "text/x-vCard" ); |
991 | } else { | 991 | } else { |
992 | qDebug("KA: Error open temp beam file "); | 992 | qDebug("KA: Error open temp beam file "); |
993 | return; | 993 | return; |
994 | } | 994 | } |
995 | #endif | 995 | #endif |
996 | 996 | ||
997 | } | 997 | } |
998 | 998 | ||
999 | void KABCore::beamDone( Ir *ir ) | 999 | void KABCore::beamDone( Ir *ir ) |
1000 | { | 1000 | { |
1001 | #ifndef DESKTOP_VERSION | 1001 | #ifndef DESKTOP_VERSION |
1002 | delete ir; | 1002 | delete ir; |
1003 | #endif | 1003 | #endif |
1004 | topLevelWidget()->raise(); | 1004 | topLevelWidget()->raise(); |
1005 | message( i18n("Beaming finished!") ); | 1005 | message( i18n("Beaming finished!") ); |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | 1008 | ||
1009 | void KABCore::browse( const QString& url ) | 1009 | void KABCore::browse( const QString& url ) |
1010 | { | 1010 | { |
1011 | #ifndef KAB_EMBEDDED | 1011 | #ifndef KAB_EMBEDDED |
1012 | kapp->invokeBrowser( url ); | 1012 | kapp->invokeBrowser( url ); |
1013 | #else //KAB_EMBEDDED | 1013 | #else //KAB_EMBEDDED |
1014 | qDebug("KABCore::browse must be fixed"); | 1014 | qDebug("KABCore::browse must be fixed"); |
1015 | #endif //KAB_EMBEDDED | 1015 | #endif //KAB_EMBEDDED |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void KABCore::selectAllContacts() | 1018 | void KABCore::selectAllContacts() |
1019 | { | 1019 | { |
1020 | mViewManager->setSelected( QString::null, true ); | 1020 | mViewManager->setSelected( QString::null, true ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void KABCore::deleteContacts() | 1023 | void KABCore::deleteContacts() |
1024 | { | 1024 | { |
1025 | QStringList uidList = mViewManager->selectedUids(); | 1025 | QStringList uidList = mViewManager->selectedUids(); |
1026 | deleteContacts( uidList ); | 1026 | deleteContacts( uidList ); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void KABCore::deleteContacts( const QStringList &uids ) | 1029 | void KABCore::deleteContacts( const QStringList &uids ) |
1030 | { | 1030 | { |
1031 | if ( uids.count() > 0 ) { | 1031 | if ( uids.count() > 0 ) { |
1032 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1032 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1033 | UndoStack::instance()->push( command ); | 1033 | UndoStack::instance()->push( command ); |
1034 | RedoStack::instance()->clear(); | 1034 | RedoStack::instance()->clear(); |
1035 | 1035 | ||
1036 | // now if we deleted anything, refresh | 1036 | // now if we deleted anything, refresh |
1037 | setContactSelected( QString::null ); | 1037 | setContactSelected( QString::null ); |
1038 | setModified( true ); | 1038 | setModified( true ); |
1039 | } | 1039 | } |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | void KABCore::copyContacts() | 1042 | void KABCore::copyContacts() |
1043 | { | 1043 | { |
1044 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1044 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1045 | 1045 | ||
1046 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 1046 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
1047 | 1047 | ||
1048 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 1048 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
1049 | 1049 | ||
1050 | QClipboard *cb = QApplication::clipboard(); | 1050 | QClipboard *cb = QApplication::clipboard(); |
1051 | cb->setText( clipText ); | 1051 | cb->setText( clipText ); |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | void KABCore::cutContacts() | 1054 | void KABCore::cutContacts() |
1055 | { | 1055 | { |
1056 | QStringList uidList = mViewManager->selectedUids(); | 1056 | QStringList uidList = mViewManager->selectedUids(); |
1057 | 1057 | ||
1058 | //US if ( uidList.size() > 0 ) { | 1058 | //US if ( uidList.size() > 0 ) { |
1059 | if ( uidList.count() > 0 ) { | 1059 | if ( uidList.count() > 0 ) { |
1060 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1060 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1061 | UndoStack::instance()->push( command ); | 1061 | UndoStack::instance()->push( command ); |
1062 | RedoStack::instance()->clear(); | 1062 | RedoStack::instance()->clear(); |
1063 | 1063 | ||
1064 | setModified( true ); | 1064 | setModified( true ); |
1065 | } | 1065 | } |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void KABCore::pasteContacts() | 1068 | void KABCore::pasteContacts() |
1069 | { | 1069 | { |
1070 | QClipboard *cb = QApplication::clipboard(); | 1070 | QClipboard *cb = QApplication::clipboard(); |
1071 | 1071 | ||
1072 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1072 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1073 | 1073 | ||
1074 | pasteContacts( list ); | 1074 | pasteContacts( list ); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1077 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1078 | { | 1078 | { |
1079 | KABC::Resource *resource = requestResource( this ); | 1079 | KABC::Resource *resource = requestResource( this ); |
1080 | KABC::Addressee::List::Iterator it; | 1080 | KABC::Addressee::List::Iterator it; |
1081 | for ( it = list.begin(); it != list.end(); ++it ) | 1081 | for ( it = list.begin(); it != list.end(); ++it ) |
1082 | (*it).setResource( resource ); | 1082 | (*it).setResource( resource ); |
1083 | 1083 | ||
1084 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1084 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1085 | UndoStack::instance()->push( command ); | 1085 | UndoStack::instance()->push( command ); |
1086 | RedoStack::instance()->clear(); | 1086 | RedoStack::instance()->clear(); |
1087 | 1087 | ||
1088 | setModified( true ); | 1088 | setModified( true ); |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | void KABCore::setWhoAmI() | 1091 | void KABCore::setWhoAmI() |
1092 | { | 1092 | { |
1093 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1093 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1094 | 1094 | ||
1095 | if ( addrList.count() > 1 ) { | 1095 | if ( addrList.count() > 1 ) { |
1096 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1096 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1097 | return; | 1097 | return; |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1100 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1101 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1101 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1102 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1102 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1103 | } | 1103 | } |
1104 | void KABCore::editCategories() | 1104 | void KABCore::editCategories() |
1105 | { | 1105 | { |
1106 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1106 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1107 | dlg.exec(); | 1107 | dlg.exec(); |
1108 | } | 1108 | } |
1109 | void KABCore::setCategories() | 1109 | void KABCore::setCategories() |
1110 | { | 1110 | { |
1111 | 1111 | ||
1112 | QStringList uids; | 1112 | QStringList uids; |
1113 | XXPortSelectDialog dlgx( this, false, this ); | 1113 | XXPortSelectDialog dlgx( this, false, this ); |
1114 | if ( dlgx.exec() ) | 1114 | if ( dlgx.exec() ) |
1115 | uids = dlgx.uids(); | 1115 | uids = dlgx.uids(); |
1116 | else | 1116 | else |
1117 | return; | 1117 | return; |
1118 | if ( uids.isEmpty() ) | 1118 | if ( uids.isEmpty() ) |
1119 | return; | 1119 | return; |
1120 | // qDebug("count %d ", uids.count()); | 1120 | // qDebug("count %d ", uids.count()); |
1121 | 1121 | ||
1122 | 1122 | ||
1123 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1123 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1124 | if ( !dlg.exec() ) { | 1124 | if ( !dlg.exec() ) { |
1125 | message( i18n("Setting categories cancelled") ); | 1125 | message( i18n("Setting categories cancelled") ); |
1126 | return; | 1126 | return; |
1127 | } | 1127 | } |
1128 | bool merge = false; | 1128 | bool merge = false; |
1129 | QString msg = i18n( "Merge with existing categories?" ); | 1129 | QString msg = i18n( "Merge with existing categories?" ); |
1130 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1130 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1131 | merge = true; | 1131 | merge = true; |
1132 | 1132 | ||
1133 | message( i18n("Setting categories ... please wait!") ); | 1133 | message( i18n("Setting categories ... please wait!") ); |
1134 | QStringList categories = dlg.selectedCategories(); | 1134 | QStringList categories = dlg.selectedCategories(); |
1135 | 1135 | ||
1136 | //QStringList uids = mViewManager->selectedUids(); | 1136 | //QStringList uids = mViewManager->selectedUids(); |
1137 | QStringList::Iterator it; | 1137 | QStringList::Iterator it; |
1138 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1138 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1139 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1139 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1140 | if ( !addr.isEmpty() ) { | 1140 | if ( !addr.isEmpty() ) { |
1141 | if ( !merge ) | 1141 | if ( !merge ) |
1142 | addr.setCategories( categories ); | 1142 | addr.setCategories( categories ); |
1143 | else { | 1143 | else { |
1144 | QStringList addrCategories = addr.categories(); | 1144 | QStringList addrCategories = addr.categories(); |
1145 | QStringList::Iterator catIt; | 1145 | QStringList::Iterator catIt; |
1146 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1146 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1147 | if ( !addrCategories.contains( *catIt ) ) | 1147 | if ( !addrCategories.contains( *catIt ) ) |
1148 | addrCategories.append( *catIt ); | 1148 | addrCategories.append( *catIt ); |
1149 | } | 1149 | } |
1150 | addr.setCategories( addrCategories ); | 1150 | addr.setCategories( addrCategories ); |
1151 | } | 1151 | } |
1152 | mAddressBook->insertAddressee( addr ); | 1152 | mAddressBook->insertAddressee( addr ); |
1153 | } | 1153 | } |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | if ( uids.count() > 0 ) | 1156 | if ( uids.count() > 0 ) |
1157 | setModified( true ); | 1157 | setModified( true ); |
1158 | message( i18n("Setting categories completed!") ); | 1158 | message( i18n("Setting categories completed!") ); |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1161 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1162 | { | 1162 | { |
1163 | mIncSearchWidget->setFields( fields ); | 1163 | mIncSearchWidget->setFields( fields ); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | void KABCore::incrementalSearch( const QString& text ) | 1166 | void KABCore::incrementalSearch( const QString& text ) |
1167 | { | 1167 | { |
1168 | QString stext; | 1168 | QString stext; |
1169 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { | 1169 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { |
1170 | stext = "*" + text; | 1170 | stext = "*" + text; |
1171 | } else { | 1171 | } else { |
1172 | stext = text; | 1172 | stext = text; |
1173 | } | 1173 | } |
1174 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); | 1174 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); |
1175 | } | 1175 | } |
1176 | void KABCore::incrementalSearchJump( const QString& text ) | ||
1177 | { | ||
1178 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | ||
1179 | } | ||
1176 | 1180 | ||
1177 | void KABCore::setModified() | 1181 | void KABCore::setModified() |
1178 | { | 1182 | { |
1179 | setModified( true ); | 1183 | setModified( true ); |
1180 | } | 1184 | } |
1181 | 1185 | ||
1182 | void KABCore::setModifiedWOrefresh() | 1186 | void KABCore::setModifiedWOrefresh() |
1183 | { | 1187 | { |
1184 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1188 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1185 | mModified = true; | 1189 | mModified = true; |
1186 | mActionSave->setEnabled( mModified ); | 1190 | mActionSave->setEnabled( mModified ); |
1187 | 1191 | ||
1188 | 1192 | ||
1189 | } | 1193 | } |
1190 | void KABCore::setModified( bool modified ) | 1194 | void KABCore::setModified( bool modified ) |
1191 | { | 1195 | { |
1192 | mModified = modified; | 1196 | mModified = modified; |
1193 | mActionSave->setEnabled( mModified ); | 1197 | mActionSave->setEnabled( mModified ); |
1194 | 1198 | ||
1195 | if ( modified ) | 1199 | if ( modified ) |
1196 | mJumpButtonBar->recreateButtons(); | 1200 | mJumpButtonBar->recreateButtons(); |
1197 | 1201 | ||
1198 | mViewManager->refreshView(); | 1202 | mViewManager->refreshView(); |
1199 | 1203 | ||
1200 | } | 1204 | } |
1201 | 1205 | ||
1202 | bool KABCore::modified() const | 1206 | bool KABCore::modified() const |
1203 | { | 1207 | { |
1204 | return mModified; | 1208 | return mModified; |
1205 | } | 1209 | } |
1206 | 1210 | ||
1207 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1211 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1208 | { | 1212 | { |
1209 | addrModified( addr ); | 1213 | addrModified( addr ); |
1210 | #if 0 // debug only | 1214 | #if 0 // debug only |
1211 | KABC::Addressee ad = addr; | 1215 | KABC::Addressee ad = addr; |
1212 | ad.computeCsum( "123"); | 1216 | ad.computeCsum( "123"); |
1213 | #endif | 1217 | #endif |
1214 | } | 1218 | } |
1215 | 1219 | ||
1216 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | 1220 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) |
1217 | { | 1221 | { |
1218 | 1222 | ||
1219 | Command *command = 0; | 1223 | Command *command = 0; |
1220 | QString uid; | 1224 | QString uid; |
1221 | 1225 | ||
1222 | // check if it exists already | 1226 | // check if it exists already |
1223 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1227 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1224 | if ( origAddr.isEmpty() ) | 1228 | if ( origAddr.isEmpty() ) |
1225 | command = new PwNewCommand( mAddressBook, addr ); | 1229 | command = new PwNewCommand( mAddressBook, addr ); |
1226 | else { | 1230 | else { |
1227 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1231 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1228 | uid = addr.uid(); | 1232 | uid = addr.uid(); |
1229 | } | 1233 | } |
1230 | 1234 | ||
1231 | UndoStack::instance()->push( command ); | 1235 | UndoStack::instance()->push( command ); |
1232 | RedoStack::instance()->clear(); | 1236 | RedoStack::instance()->clear(); |
1233 | if ( updateDetails ) | 1237 | if ( updateDetails ) |
1234 | mDetails->setAddressee( addr ); | 1238 | mDetails->setAddressee( addr ); |
1235 | setModified( true ); | 1239 | setModified( true ); |
1236 | } | 1240 | } |
1237 | 1241 | ||
1238 | void KABCore::newContact() | 1242 | void KABCore::newContact() |
1239 | { | 1243 | { |
1240 | 1244 | ||
1241 | 1245 | ||
1242 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1246 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1243 | 1247 | ||
1244 | QPtrList<KRES::Resource> kresResources; | 1248 | QPtrList<KRES::Resource> kresResources; |
1245 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1249 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1246 | KABC::Resource *resource; | 1250 | KABC::Resource *resource; |
1247 | while ( ( resource = it.current() ) != 0 ) { | 1251 | while ( ( resource = it.current() ) != 0 ) { |
1248 | ++it; | 1252 | ++it; |
1249 | if ( !resource->readOnly() ) { | 1253 | if ( !resource->readOnly() ) { |
1250 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1254 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1251 | if ( res ) | 1255 | if ( res ) |
1252 | kresResources.append( res ); | 1256 | kresResources.append( res ); |
1253 | } | 1257 | } |
1254 | } | 1258 | } |
1255 | 1259 | ||
1256 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1260 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1257 | resource = static_cast<KABC::Resource*>( res ); | 1261 | resource = static_cast<KABC::Resource*>( res ); |
1258 | 1262 | ||
1259 | if ( resource ) { | 1263 | if ( resource ) { |
1260 | KABC::Addressee addr; | 1264 | KABC::Addressee addr; |
1261 | addr.setResource( resource ); | 1265 | addr.setResource( resource ); |
1262 | mEditorDialog->setAddressee( addr ); | 1266 | mEditorDialog->setAddressee( addr ); |
1263 | mEditorDialog->setCaption( i18n("Edit new contact")); | 1267 | mEditorDialog->setCaption( i18n("Edit new contact")); |
1264 | KApplication::execDialog ( mEditorDialog ); | 1268 | KApplication::execDialog ( mEditorDialog ); |
1265 | 1269 | ||
1266 | } else | 1270 | } else |
1267 | return; | 1271 | return; |
1268 | 1272 | ||
1269 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1273 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1270 | 1274 | ||
1271 | 1275 | ||
1272 | } | 1276 | } |
1273 | 1277 | ||
1274 | void KABCore::addEmail( QString aStr ) | 1278 | void KABCore::addEmail( QString aStr ) |
1275 | { | 1279 | { |
1276 | #ifndef KAB_EMBEDDED | 1280 | #ifndef KAB_EMBEDDED |
1277 | QString fullName, email; | 1281 | QString fullName, email; |
1278 | 1282 | ||
1279 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1283 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1280 | 1284 | ||
1281 | // Try to lookup the addressee matching the email address | 1285 | // Try to lookup the addressee matching the email address |
1282 | bool found = false; | 1286 | bool found = false; |
1283 | QStringList emailList; | 1287 | QStringList emailList; |
1284 | KABC::AddressBook::Iterator it; | 1288 | KABC::AddressBook::Iterator it; |
1285 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1289 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1286 | emailList = (*it).emails(); | 1290 | emailList = (*it).emails(); |
1287 | if ( emailList.contains( email ) > 0 ) { | 1291 | if ( emailList.contains( email ) > 0 ) { |
1288 | found = true; | 1292 | found = true; |
1289 | (*it).setNameFromString( fullName ); | 1293 | (*it).setNameFromString( fullName ); |
1290 | editContact( (*it).uid() ); | 1294 | editContact( (*it).uid() ); |
1291 | } | 1295 | } |
1292 | } | 1296 | } |
1293 | 1297 | ||
1294 | if ( !found ) { | 1298 | if ( !found ) { |
1295 | KABC::Addressee addr; | 1299 | KABC::Addressee addr; |
1296 | addr.setNameFromString( fullName ); | 1300 | addr.setNameFromString( fullName ); |
1297 | addr.insertEmail( email, true ); | 1301 | addr.insertEmail( email, true ); |
1298 | 1302 | ||
1299 | mAddressBook->insertAddressee( addr ); | 1303 | mAddressBook->insertAddressee( addr ); |
1300 | mViewManager->refreshView( addr.uid() ); | 1304 | mViewManager->refreshView( addr.uid() ); |
1301 | editContact( addr.uid() ); | 1305 | editContact( addr.uid() ); |
1302 | } | 1306 | } |
1303 | #else //KAB_EMBEDDED | 1307 | #else //KAB_EMBEDDED |
1304 | qDebug("KABCore::addEmail finsih method"); | 1308 | qDebug("KABCore::addEmail finsih method"); |
1305 | #endif //KAB_EMBEDDED | 1309 | #endif //KAB_EMBEDDED |
1306 | } | 1310 | } |
1307 | 1311 | ||
1308 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1312 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1309 | { | 1313 | { |
1310 | mXXPortManager->importVCard( url, showPreview ); | 1314 | mXXPortManager->importVCard( url, showPreview ); |
1311 | } | 1315 | } |
1312 | void KABCore::importFromOL() | 1316 | void KABCore::importFromOL() |
1313 | { | 1317 | { |
1314 | #ifdef _OL_IMPORT_ | 1318 | #ifdef _OL_IMPORT_ |
1315 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1319 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1316 | idgl->exec(); | 1320 | idgl->exec(); |
1317 | KABC::Addressee::List list = idgl->getAddressList(); | 1321 | KABC::Addressee::List list = idgl->getAddressList(); |
1318 | if ( list.count() > 0 ) { | 1322 | if ( list.count() > 0 ) { |
1319 | KABC::Addressee::List listNew; | 1323 | KABC::Addressee::List listNew; |
1320 | KABC::Addressee::List listExisting; | 1324 | KABC::Addressee::List listExisting; |
1321 | KABC::Addressee::List::Iterator it; | 1325 | KABC::Addressee::List::Iterator it; |
1322 | KABC::AddressBook::Iterator iter; | 1326 | KABC::AddressBook::Iterator iter; |
1323 | for ( it = list.begin(); it != list.end(); ++it ) { | 1327 | for ( it = list.begin(); it != list.end(); ++it ) { |
1324 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1328 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1325 | listNew.append( (*it) ); | 1329 | listNew.append( (*it) ); |
1326 | else | 1330 | else |
1327 | listExisting.append( (*it) ); | 1331 | listExisting.append( (*it) ); |
1328 | } | 1332 | } |
1329 | if ( listExisting.count() > 0 ) | 1333 | if ( listExisting.count() > 0 ) |
1330 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1334 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1331 | if ( listNew.count() > 0 ) { | 1335 | if ( listNew.count() > 0 ) { |
1332 | pasteWithNewUid = false; | 1336 | pasteWithNewUid = false; |
1333 | pasteContacts( listNew ); | 1337 | pasteContacts( listNew ); |
1334 | pasteWithNewUid = true; | 1338 | pasteWithNewUid = true; |
1335 | } | 1339 | } |
1336 | } | 1340 | } |
1337 | delete idgl; | 1341 | delete idgl; |
1338 | #endif | 1342 | #endif |
1339 | } | 1343 | } |
1340 | 1344 | ||
1341 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1345 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1342 | { | 1346 | { |
1343 | mXXPortManager->importVCard( vCard, showPreview ); | 1347 | mXXPortManager->importVCard( vCard, showPreview ); |
1344 | } | 1348 | } |
1345 | 1349 | ||
1346 | //US added a second method without defaultparameter | 1350 | //US added a second method without defaultparameter |
1347 | void KABCore::editContact2() { | 1351 | void KABCore::editContact2() { |
1348 | editContact( QString::null ); | 1352 | editContact( QString::null ); |
1349 | } | 1353 | } |
1350 | 1354 | ||
1351 | void KABCore::editContact( const QString &uid ) | 1355 | void KABCore::editContact( const QString &uid ) |
1352 | { | 1356 | { |
1353 | 1357 | ||
1354 | if ( mExtensionManager->isQuickEditVisible() ) | 1358 | if ( mExtensionManager->isQuickEditVisible() ) |
1355 | return; | 1359 | return; |
1356 | 1360 | ||
1357 | // First, locate the contact entry | 1361 | // First, locate the contact entry |
1358 | QString localUID = uid; | 1362 | QString localUID = uid; |
1359 | if ( localUID.isNull() ) { | 1363 | if ( localUID.isNull() ) { |
1360 | QStringList uidList = mViewManager->selectedUids(); | 1364 | QStringList uidList = mViewManager->selectedUids(); |
1361 | if ( uidList.count() > 0 ) | 1365 | if ( uidList.count() > 0 ) |
1362 | localUID = *( uidList.at( 0 ) ); | 1366 | localUID = *( uidList.at( 0 ) ); |
1363 | } | 1367 | } |
1364 | 1368 | ||
1365 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1369 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1366 | if ( !addr.isEmpty() ) { | 1370 | if ( !addr.isEmpty() ) { |
1367 | mEditorDialog->setAddressee( addr ); | 1371 | mEditorDialog->setAddressee( addr ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 47ea152..d89daee 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -64,384 +64,385 @@ class KActionCollection; | |||
64 | class KToggleAction; | 64 | class KToggleAction; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | 66 | ||
67 | class QAction; | 67 | class QAction; |
68 | class QMenuBar; | 68 | class QMenuBar; |
69 | class QSplitter; | 69 | class QSplitter; |
70 | class ViewContainer; | 70 | class ViewContainer; |
71 | class ViewManager; | 71 | class ViewManager; |
72 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
73 | class Ir; | 73 | class Ir; |
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
86 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 87 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /** |
101 | Returns a pointer to the StdAddressBook of the application. | 101 | Returns a pointer to the StdAddressBook of the application. |
102 | */ | 102 | */ |
103 | KABC::AddressBook *addressBook() const; | 103 | KABC::AddressBook *addressBook() const; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Returns a pointer to the KConfig object of the application. | 106 | Returns a pointer to the KConfig object of the application. |
107 | */ | 107 | */ |
108 | static KConfig *config(); | 108 | static KConfig *config(); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | Returns a pointer to the global KActionCollection object. So | 111 | Returns a pointer to the global KActionCollection object. So |
112 | other classes can register their actions easily. | 112 | other classes can register their actions easily. |
113 | */ | 113 | */ |
114 | KActionCollection *actionCollection() const; | 114 | KActionCollection *actionCollection() const; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | Returns the current search field of the Incremental Search Widget. | 117 | Returns the current search field of the Incremental Search Widget. |
118 | */ | 118 | */ |
119 | KABC::Field *currentSearchField() const; | 119 | KABC::Field *currentSearchField() const; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | Returns the uid list of the currently selected contacts. | 122 | Returns the uid list of the currently selected contacts. |
123 | */ | 123 | */ |
124 | QStringList selectedUIDs() const; | 124 | QStringList selectedUIDs() const; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | Displays the ResourceSelectDialog and returns the selected | 127 | Displays the ResourceSelectDialog and returns the selected |
128 | resource or a null pointer if no resource was selected by | 128 | resource or a null pointer if no resource was selected by |
129 | the user. | 129 | the user. |
130 | */ | 130 | */ |
131 | KABC::Resource *requestResource( QWidget *parent ); | 131 | KABC::Resource *requestResource( QWidget *parent ); |
132 | 132 | ||
133 | #ifndef KAB_EMBEDDED | 133 | #ifndef KAB_EMBEDDED |
134 | static KAboutData *createAboutData(); | 134 | static KAboutData *createAboutData(); |
135 | #endif //KAB_EMBEDDED | 135 | #endif //KAB_EMBEDDED |
136 | 136 | ||
137 | #ifdef KAB_EMBEDDED | 137 | #ifdef KAB_EMBEDDED |
138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
140 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
141 | 141 | ||
142 | public slots: | 142 | public slots: |
143 | #ifdef KAB_EMBEDDED | 143 | #ifdef KAB_EMBEDDED |
144 | void createAboutData(); | 144 | void createAboutData(); |
145 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
146 | void setDetailsToggle(); | 146 | void setDetailsToggle(); |
147 | 147 | ||
148 | void showLicence(); | 148 | void showLicence(); |
149 | void faq(); | 149 | void faq(); |
150 | void whatsnew() ; | 150 | void whatsnew() ; |
151 | void synchowto() ; | 151 | void synchowto() ; |
152 | void multisynchowto() ; | 152 | void multisynchowto() ; |
153 | void kdesynchowto() ; | 153 | void kdesynchowto() ; |
154 | void writeToPhone(); | 154 | void writeToPhone(); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | Is called whenever a contact is selected in the view. | 157 | Is called whenever a contact is selected in the view. |
158 | */ | 158 | */ |
159 | void setContactSelected( const QString &uid ); | 159 | void setContactSelected( const QString &uid ); |
160 | 160 | ||
161 | /** | 161 | /** |
162 | Opens the preferred mail composer with all selected contacts as | 162 | Opens the preferred mail composer with all selected contacts as |
163 | arguments. | 163 | arguments. |
164 | */ | 164 | */ |
165 | void sendMail(); | 165 | void sendMail(); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | Opens the preferred mail composer with the given contacts as | 168 | Opens the preferred mail composer with the given contacts as |
169 | arguments. | 169 | arguments. |
170 | */ | 170 | */ |
171 | void sendMail( const QString& email ); | 171 | void sendMail( const QString& email ); |
172 | 172 | ||
173 | 173 | ||
174 | void mailVCard(); | 174 | void mailVCard(); |
175 | void mailVCard(const QStringList& uids); | 175 | void mailVCard(const QStringList& uids); |
176 | 176 | ||
177 | /** | 177 | /** |
178 | Beams the "WhoAmI contact. | 178 | Beams the "WhoAmI contact. |
179 | */ | 179 | */ |
180 | void beamMySelf(); | 180 | void beamMySelf(); |
181 | 181 | ||
182 | void beamVCard(); | 182 | void beamVCard(); |
183 | void export2phone(); | 183 | void export2phone(); |
184 | void beamVCard(const QStringList& uids); | 184 | void beamVCard(const QStringList& uids); |
185 | void beamDone( Ir *ir ); | 185 | void beamDone( Ir *ir ); |
186 | 186 | ||
187 | 187 | ||
188 | /** | 188 | /** |
189 | Starts the preferred web browser with the given URL as argument. | 189 | Starts the preferred web browser with the given URL as argument. |
190 | */ | 190 | */ |
191 | void browse( const QString& url ); | 191 | void browse( const QString& url ); |
192 | 192 | ||
193 | /** | 193 | /** |
194 | Select all contacts in the view. | 194 | Select all contacts in the view. |
195 | */ | 195 | */ |
196 | void selectAllContacts(); | 196 | void selectAllContacts(); |
197 | 197 | ||
198 | /** | 198 | /** |
199 | Deletes all selected contacts from the address book. | 199 | Deletes all selected contacts from the address book. |
200 | */ | 200 | */ |
201 | void deleteContacts(); | 201 | void deleteContacts(); |
202 | 202 | ||
203 | /** | 203 | /** |
204 | Deletes given contacts from the address book. | 204 | Deletes given contacts from the address book. |
205 | 205 | ||
206 | @param uids The uids of the contacts, which shall be deleted. | 206 | @param uids The uids of the contacts, which shall be deleted. |
207 | */ | 207 | */ |
208 | void deleteContacts( const QStringList &uids ); | 208 | void deleteContacts( const QStringList &uids ); |
209 | 209 | ||
210 | /** | 210 | /** |
211 | Copys the selected contacts into clipboard for later pasting. | 211 | Copys the selected contacts into clipboard for later pasting. |
212 | */ | 212 | */ |
213 | void copyContacts(); | 213 | void copyContacts(); |
214 | 214 | ||
215 | /** | 215 | /** |
216 | Cuts the selected contacts and stores them for later pasting. | 216 | Cuts the selected contacts and stores them for later pasting. |
217 | */ | 217 | */ |
218 | void cutContacts(); | 218 | void cutContacts(); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | Paste contacts from clipboard into the address book. | 221 | Paste contacts from clipboard into the address book. |
222 | */ | 222 | */ |
223 | void pasteContacts(); | 223 | void pasteContacts(); |
224 | 224 | ||
225 | /** | 225 | /** |
226 | Paste given contacts into the address book. | 226 | Paste given contacts into the address book. |
227 | 227 | ||
228 | @param list The list of addressee, which shall be pasted. | 228 | @param list The list of addressee, which shall be pasted. |
229 | */ | 229 | */ |
230 | void pasteContacts( KABC::Addressee::List &list ); | 230 | void pasteContacts( KABC::Addressee::List &list ); |
231 | 231 | ||
232 | /** | 232 | /** |
233 | Sets the whoAmI contact, that is used by many other programs to | 233 | Sets the whoAmI contact, that is used by many other programs to |
234 | get personal information about the current user. | 234 | get personal information about the current user. |
235 | */ | 235 | */ |
236 | void setWhoAmI(); | 236 | void setWhoAmI(); |
237 | 237 | ||
238 | /** | 238 | /** |
239 | Displays the category dialog and applies the result to all | 239 | Displays the category dialog and applies the result to all |
240 | selected contacts. | 240 | selected contacts. |
241 | */ | 241 | */ |
242 | void setCategories(); | 242 | void setCategories(); |
243 | void manageCategories(); | 243 | void manageCategories(); |
244 | void editCategories(); | 244 | void editCategories(); |
245 | 245 | ||
246 | /** | 246 | /** |
247 | Sets the field list of the Incremental Search Widget. | 247 | Sets the field list of the Incremental Search Widget. |
248 | */ | 248 | */ |
249 | void setSearchFields( const KABC::Field::List &fields ); | 249 | void setSearchFields( const KABC::Field::List &fields ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | Search with the current search field for a contact, that matches | 252 | Search with the current search field for a contact, that matches |
253 | the given text, and selects it in the view. | 253 | the given text, and selects it in the view. |
254 | */ | 254 | */ |
255 | void incrementalSearch( const QString& text ); | 255 | void incrementalSearch( const QString& text ); |
256 | void incrementalSearchJump( const QString& text ); | ||
256 | 257 | ||
257 | /** | 258 | /** |
258 | Marks the address book as modified. | 259 | Marks the address book as modified. |
259 | */ | 260 | */ |
260 | void setModified(); | 261 | void setModified(); |
261 | /** | 262 | /** |
262 | Marks the address book as modified without refreshing the view. | 263 | Marks the address book as modified without refreshing the view. |
263 | */ | 264 | */ |
264 | void setModifiedWOrefresh(); | 265 | void setModifiedWOrefresh(); |
265 | 266 | ||
266 | /** | 267 | /** |
267 | Marks the address book as modified concerning the argument. | 268 | Marks the address book as modified concerning the argument. |
268 | */ | 269 | */ |
269 | void setModified( bool modified ); | 270 | void setModified( bool modified ); |
270 | 271 | ||
271 | /** | 272 | /** |
272 | Returns whether the address book is modified. | 273 | Returns whether the address book is modified. |
273 | */ | 274 | */ |
274 | bool modified() const; | 275 | bool modified() const; |
275 | 276 | ||
276 | /** | 277 | /** |
277 | Called whenever an contact is modified in the contact editor | 278 | Called whenever an contact is modified in the contact editor |
278 | dialog or the quick edit. | 279 | dialog or the quick edit. |
279 | */ | 280 | */ |
280 | void contactModified( const KABC::Addressee &addr ); | 281 | void contactModified( const KABC::Addressee &addr ); |
281 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); | 282 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); |
282 | 283 | ||
283 | /** | 284 | /** |
284 | DCOP METHODS. | 285 | DCOP METHODS. |
285 | */ | 286 | */ |
286 | void addEmail( QString addr ); | 287 | void addEmail( QString addr ); |
287 | void importVCard( const KURL& url, bool showPreview ); | 288 | void importVCard( const KURL& url, bool showPreview ); |
288 | void importVCard( const QString& vCard, bool showPreview ); | 289 | void importVCard( const QString& vCard, bool showPreview ); |
289 | void newContact(); | 290 | void newContact(); |
290 | QString getNameByPhone( const QString& phone ); | 291 | QString getNameByPhone( const QString& phone ); |
291 | /** | 292 | /** |
292 | END DCOP METHODS | 293 | END DCOP METHODS |
293 | */ | 294 | */ |
294 | 295 | ||
295 | /** | 296 | /** |
296 | Saves the contents of the AddressBook back to disk. | 297 | Saves the contents of the AddressBook back to disk. |
297 | */ | 298 | */ |
298 | void save(); | 299 | void save(); |
299 | 300 | ||
300 | /** | 301 | /** |
301 | Undos the last command using the undo stack. | 302 | Undos the last command using the undo stack. |
302 | */ | 303 | */ |
303 | void undo(); | 304 | void undo(); |
304 | 305 | ||
305 | /** | 306 | /** |
306 | Redos the last command that was undone, using the redo stack. | 307 | Redos the last command that was undone, using the redo stack. |
307 | */ | 308 | */ |
308 | void redo(); | 309 | void redo(); |
309 | 310 | ||
310 | /** | 311 | /** |
311 | Shows the edit dialog for the given uid. If the uid is QString::null, | 312 | Shows the edit dialog for the given uid. If the uid is QString::null, |
312 | the method will try to find a selected addressee in the view. | 313 | the method will try to find a selected addressee in the view. |
313 | */ | 314 | */ |
314 | void editContact( const QString &uid /*US = QString::null*/ ); | 315 | void editContact( const QString &uid /*US = QString::null*/ ); |
315 | //US added a second method without defaultparameter | 316 | //US added a second method without defaultparameter |
316 | void editContact2(); | 317 | void editContact2(); |
317 | 318 | ||
318 | /** | 319 | /** |
319 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 320 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
320 | the method will try to find a selected addressee in the view. | 321 | the method will try to find a selected addressee in the view. |
321 | */ | 322 | */ |
322 | void executeContact( const QString &uid /*US = QString::null*/ ); | 323 | void executeContact( const QString &uid /*US = QString::null*/ ); |
323 | 324 | ||
324 | /** | 325 | /** |
325 | Launches the configuration dialog. | 326 | Launches the configuration dialog. |
326 | */ | 327 | */ |
327 | void openConfigDialog(); | 328 | void openConfigDialog(); |
328 | 329 | ||
329 | /** | 330 | /** |
330 | Launches the ldap search dialog. | 331 | Launches the ldap search dialog. |
331 | */ | 332 | */ |
332 | void openLDAPDialog(); | 333 | void openLDAPDialog(); |
333 | 334 | ||
334 | /** | 335 | /** |
335 | Creates a KAddressBookPrinter, which will display the print | 336 | Creates a KAddressBookPrinter, which will display the print |
336 | dialog and do the printing. | 337 | dialog and do the printing. |
337 | */ | 338 | */ |
338 | void print(); | 339 | void print(); |
339 | 340 | ||
340 | /** | 341 | /** |
341 | Registers a new GUI client, so plugins can register its actions. | 342 | Registers a new GUI client, so plugins can register its actions. |
342 | */ | 343 | */ |
343 | void addGUIClient( KXMLGUIClient *client ); | 344 | void addGUIClient( KXMLGUIClient *client ); |
344 | 345 | ||
345 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 346 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
346 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 347 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
347 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 348 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
348 | 349 | ||
349 | 350 | ||
350 | signals: | 351 | signals: |
351 | void contactSelected( const QString &name ); | 352 | void contactSelected( const QString &name ); |
352 | void contactSelected( const QPixmap &pixmap ); | 353 | void contactSelected( const QPixmap &pixmap ); |
353 | public slots: | 354 | public slots: |
354 | void recieve(QString cmsg ); | 355 | void recieve(QString cmsg ); |
355 | void getFile( bool success ); | 356 | void getFile( bool success ); |
356 | void syncFileRequest(); | 357 | void syncFileRequest(); |
357 | void setDetailsVisible( bool visible ); | 358 | void setDetailsVisible( bool visible ); |
358 | void setDetailsToState(); | 359 | void setDetailsToState(); |
359 | 360 | ||
360 | void saveSettings(); | 361 | void saveSettings(); |
361 | 362 | ||
362 | private slots: | 363 | private slots: |
363 | void updateToolBar(); | 364 | void updateToolBar(); |
364 | void updateMainWindow(); | 365 | void updateMainWindow(); |
365 | void receive( const QCString& cmsg, const QByteArray& data ); | 366 | void receive( const QCString& cmsg, const QByteArray& data ); |
366 | void toggleBeamReceive( ); | 367 | void toggleBeamReceive( ); |
367 | void disableBR(bool); | 368 | void disableBR(bool); |
368 | void setJumpButtonBarVisible( bool visible ); | 369 | void setJumpButtonBarVisible( bool visible ); |
369 | void setJumpButtonBar( bool visible ); | 370 | void setJumpButtonBar( bool visible ); |
370 | void setCaptionBack(); | 371 | void setCaptionBack(); |
371 | void resizeAndCallContactdialog(); | 372 | void resizeAndCallContactdialog(); |
372 | void callContactdialog(); | 373 | void callContactdialog(); |
373 | 374 | ||
374 | void importFromOL(); | 375 | void importFromOL(); |
375 | void extensionModified( const KABC::Addressee::List &list ); | 376 | void extensionModified( const KABC::Addressee::List &list ); |
376 | void extensionChanged( int id ); | 377 | void extensionChanged( int id ); |
377 | void clipboardDataChanged(); | 378 | void clipboardDataChanged(); |
378 | void updateActionMenu(); | 379 | void updateActionMenu(); |
379 | void configureKeyBindings(); | 380 | void configureKeyBindings(); |
380 | void removeVoice(); | 381 | void removeVoice(); |
381 | void setFormattedName(); | 382 | void setFormattedName(); |
382 | #ifdef KAB_EMBEDDED | 383 | #ifdef KAB_EMBEDDED |
383 | void configureResources(); | 384 | void configureResources(); |
384 | #endif //KAB_EMBEDDED | 385 | #endif //KAB_EMBEDDED |
385 | 386 | ||
386 | void slotEditorDestroyed( const QString &uid ); | 387 | void slotEditorDestroyed( const QString &uid ); |
387 | void configurationChanged(); | 388 | void configurationChanged(); |
388 | void addressBookChanged(); | 389 | void addressBookChanged(); |
389 | 390 | ||
390 | private: | 391 | private: |
391 | QString mEmailSourceChannel; | 392 | QString mEmailSourceChannel; |
392 | void resizeEvent(QResizeEvent* e ); | 393 | void resizeEvent(QResizeEvent* e ); |
393 | bool mBRdisabled; | 394 | bool mBRdisabled; |
394 | #ifndef DESKTOP_VERSION | 395 | #ifndef DESKTOP_VERSION |
395 | QCopChannel* infrared; | 396 | QCopChannel* infrared; |
396 | #endif | 397 | #endif |
397 | QTimer *mMessageTimer; | 398 | QTimer *mMessageTimer; |
398 | void initGUI(); | 399 | void initGUI(); |
399 | void initActions(); | 400 | void initActions(); |
400 | QString getPhoneFile(); | 401 | QString getPhoneFile(); |
401 | 402 | ||
402 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 403 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
403 | const char *name = 0 ); | 404 | const char *name = 0 ); |
404 | 405 | ||
405 | KXMLGUIClient *mGUIClient; | 406 | KXMLGUIClient *mGUIClient; |
406 | 407 | ||
407 | KABC::AddressBook *mAddressBook; | 408 | KABC::AddressBook *mAddressBook; |
408 | 409 | ||
409 | ViewManager *mViewManager; | 410 | ViewManager *mViewManager; |
410 | // QSplitter *mDetailsSplitter; | 411 | // QSplitter *mDetailsSplitter; |
411 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 412 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
412 | ViewContainer *mDetails; | 413 | ViewContainer *mDetails; |
413 | KDGanttMinimizeSplitter* mMiniSplitter; | 414 | KDGanttMinimizeSplitter* mMiniSplitter; |
414 | XXPortManager *mXXPortManager; | 415 | XXPortManager *mXXPortManager; |
415 | JumpButtonBar *mJumpButtonBar; | 416 | JumpButtonBar *mJumpButtonBar; |
416 | IncSearchWidget *mIncSearchWidget; | 417 | IncSearchWidget *mIncSearchWidget; |
417 | ExtensionManager *mExtensionManager; | 418 | ExtensionManager *mExtensionManager; |
418 | 419 | ||
419 | KCMultiDialog *mConfigureDialog; | 420 | KCMultiDialog *mConfigureDialog; |
420 | 421 | ||
421 | #ifndef KAB_EMBEDDED | 422 | #ifndef KAB_EMBEDDED |
422 | LDAPSearchDialog *mLdapSearchDialog; | 423 | LDAPSearchDialog *mLdapSearchDialog; |
423 | #endif //KAB_EMBEDDED | 424 | #endif //KAB_EMBEDDED |
424 | // QDict<AddresseeEditorDialog> mEditorDict; | 425 | // QDict<AddresseeEditorDialog> mEditorDict; |
425 | AddresseeEditorDialog *mEditorDialog; | 426 | AddresseeEditorDialog *mEditorDialog; |
426 | bool mReadWrite; | 427 | bool mReadWrite; |
427 | bool mModified; | 428 | bool mModified; |
428 | bool mIsPart; | 429 | bool mIsPart; |
429 | bool mMultipleViewsAtOnce; | 430 | bool mMultipleViewsAtOnce; |
430 | 431 | ||
431 | 432 | ||
432 | //US file menu | 433 | //US file menu |
433 | KAction *mActionMail; | 434 | KAction *mActionMail; |
434 | KAction *mActionBeam; | 435 | KAction *mActionBeam; |
435 | KToggleAction *mActionBR; | 436 | KToggleAction *mActionBR; |
436 | KAction *mActionExport2phone; | 437 | KAction *mActionExport2phone; |
437 | KAction* mActionPrint; | 438 | KAction* mActionPrint; |
438 | KAction* mActionPrintDetails; | 439 | KAction* mActionPrintDetails; |
439 | KAction* mActionNewContact; | 440 | KAction* mActionNewContact; |
440 | KAction *mActionSave; | 441 | KAction *mActionSave; |
441 | KAction *mActionEditAddressee; | 442 | KAction *mActionEditAddressee; |
442 | KAction *mActionMailVCard; | 443 | KAction *mActionMailVCard; |
443 | KAction *mActionBeamVCard; | 444 | KAction *mActionBeamVCard; |
444 | 445 | ||
445 | KAction *mActionQuit; | 446 | KAction *mActionQuit; |
446 | 447 | ||
447 | //US edit menu | 448 | //US edit menu |