diff options
Diffstat (limited to 'kaddressbook/kabcore.cpp')
-rw-r--r-- | kaddressbook/kabcore.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 142f03c44..6a7ece0e8 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -108,36 +108,36 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, TQWidget *parent, this, TQT_SLOT( addressBookChanged() ) ); if ( file.isEmpty() ) { - mAddressBook = KABC::StdAddressBook::self( true ); + mAddressBook = TDEABC::StdAddressBook::self( true ); } else { kdDebug(5720) << "KABCore(): document '" << file << "'" << endl; - mAddressBook = new KABC::AddressBook; - mAddressBook->addResource( new KABC::ResourceFile( file ) ); + mAddressBook = new TDEABC::AddressBook; + mAddressBook->addResource( new TDEABC::ResourceFile( file ) ); if ( !mAddressBook->load() ) { KMessageBox::error( parent, i18n("Unable to load '%1'.").arg( file ) ); } } - mAddressBook->setErrorHandler( new KABC::GuiErrorHandler( mWidget ) ); + mAddressBook->setErrorHandler( new TDEABC::GuiErrorHandler( mWidget ) ); #if ! KDE_IS_VERSION(3,5,8) - mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, + mAddressBook->addCustomField( i18n( "Department" ), TDEABC::Field::Organization, "X-Department", "KADDRESSBOOK" ); #endif - mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, + mAddressBook->addCustomField( i18n( "Profession" ), TDEABC::Field::Organization, "X-Profession", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, + mAddressBook->addCustomField( i18n( "Assistant's Name" ), TDEABC::Field::Organization, "X-AssistantsName", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, + mAddressBook->addCustomField( i18n( "Manager's Name" ), TDEABC::Field::Organization, "X-ManagersName", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "Partner's Name" ), KABC::Field::Personal, + mAddressBook->addCustomField( i18n( "Partner's Name" ), TDEABC::Field::Personal, "X-SpousesName", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, + mAddressBook->addCustomField( i18n( "Office" ), TDEABC::Field::Personal, "X-Office", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, + mAddressBook->addCustomField( i18n( "IM Address" ), TDEABC::Field::Personal, "X-IMAddress", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, + mAddressBook->addCustomField( i18n( "Anniversary" ), TDEABC::Field::Personal, "X-Anniversary", "KADDRESSBOOK" ); - mAddressBook->addCustomField( i18n( "Blog" ), KABC::Field::Personal, + mAddressBook->addCustomField( i18n( "Blog" ), TDEABC::Field::Personal, "BlogFeed", "KADDRESSBOOK" ); mSearchManager = new KAB::SearchManager( mAddressBook, TQT_TQOBJECT(parent) ); @@ -164,8 +164,8 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, TQWidget *parent, mXXPortManager, TQT_SLOT( importVCard( const KURL& ) ) ); connect( mViewManager, TQT_SIGNAL( viewFieldsChanged() ), TQT_SLOT( updateIncSearchWidget() ) ); - connect( mExtensionManager, TQT_SIGNAL( modified( const KABC::Addressee::List& ) ), - this, TQT_SLOT( extensionModified( const KABC::Addressee::List& ) ) ); + connect( mExtensionManager, TQT_SIGNAL( modified( const TDEABC::Addressee::List& ) ), + this, TQT_SLOT( extensionModified( const TDEABC::Addressee::List& ) ) ); connect( mExtensionManager, TQT_SIGNAL( deleted( const TQStringList& ) ), this, TQT_SLOT( extensionDeleted( const TQStringList& ) ) ); @@ -200,7 +200,7 @@ KABCore::~KABCore() mAddressBook->disconnect(); mAddressBook = 0; - KABC::StdAddressBook::close(); + TDEABC::StdAddressBook::close(); mKIMProxy = 0; } @@ -245,7 +245,7 @@ void KABCore::saveSettings() KABPrefs::instance()->setCurrentIncSearchField( mIncSearchWidget->currentItem() ); } -KABC::AddressBook *KABCore::addressBook() const +TDEABC::AddressBook *KABCore::addressBook() const { return mAddressBook; } @@ -260,7 +260,7 @@ TDEActionCollection *KABCore::actionCollection() const return guiClient()->actionCollection(); } -KABC::Field *KABCore::currentSortField() const +TDEABC::Field *KABCore::currentSortField() const { return mViewManager->currentSortField(); } @@ -270,13 +270,13 @@ TQStringList KABCore::selectedUIDs() const return mViewManager->selectedUids(); } -KABC::Resource *KABCore::requestResource( TQWidget *parent ) +TDEABC::Resource *KABCore::requestResource( TQWidget *parent ) { - TQPtrList<KABC::Resource> kabcResources = addressBook()->resources(); + TQPtrList<TDEABC::Resource> kabcResources = addressBook()->resources(); TQPtrList<KRES::Resource> kresResources; - TQPtrListIterator<KABC::Resource> resIt( kabcResources ); - KABC::Resource *resource; + TQPtrListIterator<TDEABC::Resource> resIt( kabcResources ); + TDEABC::Resource *resource; while ( ( resource = resIt.current() ) != 0 ) { ++resIt; bool writable = false; @@ -302,7 +302,7 @@ KABC::Resource *KABCore::requestResource( TQWidget *parent ) } KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); - return static_cast<KABC::Resource*>( res ); // upcast + return static_cast<TDEABC::Resource*>( res ); // upcast } TQWidget *KABCore::widget() const @@ -351,7 +351,7 @@ void KABCore::setContactSelected( const TQString &uid ) return; } - KABC::Addressee addr = mAddressBook->findByUid( uid ); + TDEABC::Addressee addr = mAddressBook->findByUid( uid ); if ( !mDetailsViewer->isHidden() ) mDetailsViewer->setAddressee( addr ); #ifdef TDEPIM_NEW_DISTRLISTS @@ -361,7 +361,7 @@ void KABCore::setContactSelected( const TQString &uid ) #endif mExtensionManager->setSelectionChanged(); - KABC::Addressee::List list = mViewManager->selectedAddressees(); + TDEABC::Addressee::List list = mViewManager->selectedAddressees(); const bool someSelected = list.size() > 0; const bool singleSelected = list.size() == 1; bool writable = mReadWrite; @@ -371,9 +371,9 @@ void KABCore::setContactSelected( const TQString &uid ) //### We have a performance problem here - everytime *one* item is added or // removed we re-check *all* items. If this turns out to be a bottleneck // we need to keep some state and check new items only. - KABC::Addressee::List::ConstIterator addrIt = list.constBegin(); + TDEABC::Addressee::List::ConstIterator addrIt = list.constBegin(); for ( ; addrIt != list.constEnd(); ++addrIt ) { - KABC::Resource *res = ( *addrIt ).resource(); + TDEABC::Resource *res = ( *addrIt ).resource(); if ( !res ) { kdDebug() << "KABCore::setContactSelected: this addressee has no resource!" << endl; writable = false; @@ -398,7 +398,7 @@ void KABCore::setContactSelected( const TQString &uid ) bool moreThanOneResource = mAddressBook->resources().count() > 1; if ( !moreThanOneResource && !mAddressBook->resources().isEmpty() ) { - KABC::Resource *res = mAddressBook->resources().first(); + TDEABC::Resource *res = mAddressBook->resources().first(); if ( res->inherits( "KPIM::ResourceABC" ) ) { KPIM::ResourceABC *resAbc = static_cast<KPIM::ResourceABC *>( res ); const TQStringList subresources = resAbc->subresources(); @@ -517,7 +517,7 @@ void KABCore::deleteContacts( const TQStringList &uids ) TQStringList::ConstIterator it = uids.begin(); const TQStringList::ConstIterator endIt( uids.end() ); while ( it != endIt ) { - KABC::Addressee addr = mAddressBook->findByUid( *it ); + TDEABC::Addressee addr = mAddressBook->findByUid( *it ); names.append( addr.realName().isEmpty() ? addr.preferredEmail() : addr.realName() ); ++it; } @@ -548,7 +548,7 @@ void KABCore::deleteContacts( const TQStringList &uids ) void KABCore::copyContacts() { - KABC::Addressee::List addrList = mViewManager->selectedAddressees(); + TDEABC::Addressee::List addrList = mViewManager->selectedAddressees(); #if defined(KABC_VCARD_ENCODING_FIX) TQByteArray clipText = AddresseeUtil::addresseesToClipboard( addrList ); @@ -578,21 +578,21 @@ void KABCore::pasteContacts() TQClipboard *cb = TQApplication::clipboard(); #if defined(KABC_VCARD_ENCODING_FIX) const TQMimeSource *data = cb->data( TQClipboard::Clipboard ); - KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( data->encodedData( "text/x-vcard" ) ); + TDEABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( data->encodedData( "text/x-vcard" ) ); #else - KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); + TDEABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); #endif pasteContacts( list ); } -void KABCore::pasteContacts( KABC::Addressee::List &list ) +void KABCore::pasteContacts( TDEABC::Addressee::List &list ) { - KABC::Resource *resource = requestResource( mWidget ); + TDEABC::Resource *resource = requestResource( mWidget ); if ( !resource ) return; - KABC::Addressee::List::Iterator it; - const KABC::Addressee::List::Iterator endIt( list.end() ); + TDEABC::Addressee::List::Iterator it; + const TDEABC::Addressee::List::Iterator endIt( list.end() ); for ( it = list.begin(); it != endIt; ++it ) (*it).setResource( resource ); @@ -604,15 +604,15 @@ void KABCore::pasteContacts( KABC::Addressee::List &list ) void KABCore::mergeContacts() { - KABC::Addressee::List list = mViewManager->selectedAddressees(); + TDEABC::Addressee::List list = mViewManager->selectedAddressees(); if ( list.count() < 2 ) return; - KABC::Addressee addr = KABTools::mergeContacts( list ); + TDEABC::Addressee addr = KABTools::mergeContacts( list ); - KABC::Addressee::List::Iterator it = list.begin(); - const KABC::Addressee::List::Iterator endIt( list.end() ); - KABC::Addressee origAddr = *it; + TDEABC::Addressee::List::Iterator it = list.begin(); + const TDEABC::Addressee::List::Iterator endIt( list.end() ); + TDEABC::Addressee origAddr = *it; TQStringList uids; ++it; while ( it != endIt ) { @@ -631,7 +631,7 @@ void KABCore::mergeContacts() void KABCore::setWhoAmI() { - KABC::Addressee::List addrList = mViewManager->selectedAddressees(); + TDEABC::Addressee::List addrList = mViewManager->selectedAddressees(); if ( addrList.count() > 1 ) { // can probably be removed because we now check the selection in setContactSelected(). @@ -641,7 +641,7 @@ void KABCore::setWhoAmI() TQString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); if ( KMessageBox::questionYesNo( mWidget, text.arg( addrList[ 0 ].assembledName() ), TQString(), i18n("Use"), i18n("Do Not Use") ) == KMessageBox::Yes ) - static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self( true ) )->setWhoAmI( addrList[ 0 ] ); + static_cast<TDEABC::StdAddressBook*>( TDEABC::StdAddressBook::self( true ) )->setWhoAmI( addrList[ 0 ] ); } void KABCore::incrementalTextSearch( const TQString& text ) @@ -654,12 +654,12 @@ void KABCore::incrementalJumpButtonSearch( const TQString& character ) { mViewManager->setSelected( TQString(), false ); - KABC::AddresseeList list = mSearchManager->contacts(); - KABC::Field *field = mViewManager->currentSortField(); + TDEABC::AddresseeList list = mSearchManager->contacts(); + TDEABC::Field *field = mViewManager->currentSortField(); if ( field ) { list.sortByField( field ); - KABC::AddresseeList::ConstIterator it; - const KABC::AddresseeList::ConstIterator endIt( list.end() ); + TDEABC::AddresseeList::ConstIterator it; + const TDEABC::AddresseeList::ConstIterator endIt( list.end() ); for ( it = list.begin(); it != endIt; ++it ) { if ( field->value( *it ).startsWith( character, false ) ) { mViewManager->setSelected( (*it).uid(), true ); @@ -687,14 +687,14 @@ bool KABCore::modified() const return mModified; } -void KABCore::contactModified( const KABC::Addressee &addr ) +void KABCore::contactModified( const TDEABC::Addressee &addr ) { Command *command = 0; // check if it exists already - KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); + TDEABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); if ( origAddr.isEmpty() ) { - KABC::Addressee::List addressees; + TDEABC::Addressee::List addressees; addressees.append( addr ); command = new NewCommand( mAddressBook, addressees ); } else { @@ -710,7 +710,7 @@ void KABCore::contactModified( const KABC::Addressee &addr ) void KABCore::newDistributionList() { #ifdef TDEPIM_NEW_DISTRLISTS - KABC::Resource *resource = requestResource( mWidget ); + TDEABC::Resource *resource = requestResource( mWidget ); if ( !resource ) return; @@ -736,10 +736,10 @@ void KABCore::newContact() { AddresseeEditorDialog *dialog = 0; - KABC::Resource* resource = requestResource( mWidget ); + TDEABC::Resource* resource = requestResource( mWidget ); if ( resource ) { - KABC::Addressee addr; + TDEABC::Addressee addr; addr.setResource( resource ); if ( !KABLock::self( mAddressBook )->lock( addr.resource() ) ) @@ -759,7 +759,7 @@ void KABCore::addEmail( const TQString &aStr ) { TQString fullName, email; - KABC::Addressee::parseEmailAddress( aStr, fullName, email ); + TDEABC::Addressee::parseEmailAddress( aStr, fullName, email ); #if KDE_IS_VERSION(3,4,89) // This ugly hack will be removed in 4.0 @@ -774,8 +774,8 @@ void KABCore::addEmail( const TQString &aStr ) // Try to lookup the addressee matching the email address bool found = false; TQStringList emailList; - KABC::AddressBook::Iterator it; - const KABC::AddressBook::Iterator endIt( mAddressBook->end() ); + TDEABC::AddressBook::Iterator it; + const TDEABC::AddressBook::Iterator endIt( mAddressBook->end() ); for ( it = mAddressBook->begin(); !found && (it != endIt); ++it ) { emailList = (*it).emails(); if ( emailList.contains( email ) > 0 ) { @@ -786,7 +786,7 @@ void KABCore::addEmail( const TQString &aStr ) } if ( !found ) { - KABC::Addressee addr; + TDEABC::Addressee addr; addr.setNameFromString( fullName ); addr.insertEmail( email, true ); @@ -829,7 +829,7 @@ void KABCore::editContact( const TQString &uid ) } #endif - KABC::Addressee addr = mAddressBook->findByUid( localUID ); + TDEABC::Addressee addr = mAddressBook->findByUid( localUID ); if ( !addr.isEmpty() ) { AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); if ( !dialog ) { @@ -871,7 +871,7 @@ void KABCore::storeContactIn( const TQString &uid, bool copy /*false*/ ) } else { uidList << uid; } - KABC::Resource *resource = requestResource( mWidget ); + TDEABC::Resource *resource = requestResource( mWidget ); if ( !resource ) return; @@ -890,10 +890,10 @@ void KABCore::storeContactIn( const TQString &uid, bool copy /*false*/ ) void KABCore::save() { - TQPtrList<KABC::Resource> resources = mAddressBook->resources(); - TQPtrListIterator<KABC::Resource> it( resources ); + TQPtrList<TDEABC::Resource> resources = mAddressBook->resources(); + TQPtrListIterator<TDEABC::Resource> it( resources ); while ( it.current() && !it.current()->readOnly() ) { - KABC::Ticket *ticket = mAddressBook->requestSaveTicket( it.current() ); + TDEABC::Ticket *ticket = mAddressBook->requestSaveTicket( it.current() ); if ( ticket ) { if ( !mAddressBook->save( ticket ) ) { KMessageBox::error( mWidget, @@ -914,8 +914,8 @@ void KABCore::save() void KABCore::load() { - TQPtrList<KABC::Resource> resources = mAddressBook->resources(); - TQPtrListIterator<KABC::Resource> it( resources ); + TQPtrList<TDEABC::Resource> resources = mAddressBook->resources(); + TQPtrListIterator<TDEABC::Resource> it( resources ); while ( it.current() ) { mAddressBook->load(); ++it; @@ -941,18 +941,18 @@ void KABCore::setDetailsVisible( bool visible ) mDetailsPage->hide(); } -void KABCore::extensionModified( const KABC::Addressee::List &list ) +void KABCore::extensionModified( const TDEABC::Addressee::List &list ) { if ( list.count() != 0 ) { - KABC::Addressee::List::ConstIterator it; - const KABC::Addressee::List::ConstIterator endIt( list.end() ); + TDEABC::Addressee::List::ConstIterator it; + const TDEABC::Addressee::List::ConstIterator endIt( list.end() ); for ( it = list.begin(); it != endIt; ++it ) { Command *command = 0; // check if it exists already - KABC::Addressee origAddr = mAddressBook->findByUid( (*it).uid() ); + TDEABC::Addressee origAddr = mAddressBook->findByUid( (*it).uid() ); if ( origAddr.isEmpty() ) { - KABC::Addressee::List addressees; + TDEABC::Addressee::List addressees; addressees.append( *it ); command = new NewCommand( mAddressBook, addressees ); } else @@ -994,15 +994,15 @@ TQString KABCore::getNameByPhone( const TQString &phone ) bool found = false; TQString ownerName = ""; - KABC::PhoneNumber::List phoneList; + TDEABC::PhoneNumber::List phoneList; - KABC::AddressBook::ConstIterator iter; - const KABC::AddressBook::ConstIterator endIter( mAddressBook->end() ); + TDEABC::AddressBook::ConstIterator iter; + const TDEABC::AddressBook::ConstIterator endIter( mAddressBook->end() ); for ( iter = mAddressBook->begin(); !found && ( iter != endIter ); ++iter ) { phoneList = (*iter).phoneNumbers(); - KABC::PhoneNumber::List::Iterator phoneIter( phoneList.begin() ); - const KABC::PhoneNumber::List::Iterator phoneEndIter( phoneList.end() ); + TDEABC::PhoneNumber::List::Iterator phoneIter( phoneList.begin() ); + const TDEABC::PhoneNumber::List::Iterator phoneEndIter( phoneList.end() ); for ( ; !found && ( phoneIter != phoneEndIter ); ++phoneIter) { // Get rid of separator chars so just the numbers are compared. if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { @@ -1084,13 +1084,13 @@ void KABCore::showContactsAddress( const TQString &addrUid ) if ( uidList.isEmpty() ) return; - KABC::Addressee addr = mAddressBook->findByUid( uidList.first() ); + TDEABC::Addressee addr = mAddressBook->findByUid( uidList.first() ); if ( addr.isEmpty() ) return; - const KABC::Address::List list = addr.addresses(); - KABC::Address::List::ConstIterator it; - const KABC::Address::List::ConstIterator endIt( list.end() ); + const TDEABC::Address::List list = addr.addresses(); + TDEABC::Address::List::ConstIterator it; + const TDEABC::Address::List::ConstIterator endIt( list.end() ); for ( it = list.begin(); it != endIt; ++it ) if ( (*it).id() == addrUid ) { LocationMap::instance()->showAddress( *it ); @@ -1109,8 +1109,8 @@ bool KABCore::queryClose() saveSettings(); KABPrefs::instance()->writeConfig(); - TQPtrList<KABC::Resource> resources = mAddressBook->resources(); - TQPtrListIterator<KABC::Resource> it( resources ); + TQPtrList<TDEABC::Resource> resources = mAddressBook->resources(); + TQPtrListIterator<TDEABC::Resource> it( resources ); while ( it.current() ) { it.current()->close(); ++it; @@ -1157,8 +1157,8 @@ AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( TQWidget *parent, { AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, name ? name : "editorDialog" ); - connect( dialog, TQT_SIGNAL( contactModified( const KABC::Addressee& ) ), - TQT_SLOT( contactModified( const KABC::Addressee& ) ) ); + connect( dialog, TQT_SIGNAL( contactModified( const TDEABC::Addressee& ) ), + TQT_SLOT( contactModified( const TDEABC::Addressee& ) ) ); connect( dialog, TQT_SIGNAL( editorDestroyed( const TQString& ) ), TQT_SLOT( slotEditorDestroyed( const TQString& ) ) ); @@ -1183,7 +1183,7 @@ void KABCore::slotEditorDestroyed( const TQString &uid ) { AddresseeEditorDialog *dialog = mEditorDict.take( uid ); - KABC::Addressee addr = dialog->addressee(); + TDEABC::Addressee addr = dialog->addressee(); if ( !addr.resource()->readOnly() ) { TQApplication::setOverrideCursor( TQt::waitCursor ); @@ -1471,8 +1471,8 @@ TQStringList KABCore::allCategories() const return allCategories; } - KABC::AddressBook::ConstIterator it; - const KABC::AddressBook::ConstIterator endIt( mAddressBook->end() ); + TDEABC::AddressBook::ConstIterator it; + const TDEABC::AddressBook::ConstIterator endIt( mAddressBook->end() ); for ( it = mAddressBook->begin(); it != endIt; ++it ) { categories = (*it).categories(); const TQStringList::ConstIterator catEndIt( categories.end() ); @@ -1510,7 +1510,7 @@ void KABCore::categoriesSelected( const TQStringList &categories ) TQStringList::ConstIterator it; const TQStringList::ConstIterator endIt( uids.end() ); for ( it = uids.begin(); it != endIt; ++it ) { - KABC::Addressee addr = mAddressBook->findByUid( *it ); + TDEABC::Addressee addr = mAddressBook->findByUid( *it ); if ( !addr.isEmpty() ) { if ( !merge ) addr.setCategories( categories ); @@ -1617,7 +1617,7 @@ void KABCore::removeSelectedContactsFromDistList() TQStringList::ConstIterator it = uids.begin(); const TQStringList::ConstIterator endIt( uids.end() ); while ( it != endIt ) { - KABC::Addressee addr = mAddressBook->findByUid( *it ); + TDEABC::Addressee addr = mAddressBook->findByUid( *it ); names.append( addr.realName().isEmpty() ? addr.preferredEmail() : addr.realName() ); ++it; } |