summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3f9b546..e1a490d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1167,192 +1167,193 @@ void KABCore::incrementalSearch( const QString& text )
{
QString stext;
if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
stext = "*" + text;
} else {
stext = text;
}
mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
}
void KABCore::setModified()
{
setModified( true );
}
void KABCore::setModifiedWOrefresh()
{
// qDebug("KABCore::setModifiedWOrefresh() ");
mModified = true;
mActionSave->setEnabled( mModified );
}
void KABCore::setModified( bool modified )
{
mModified = modified;
mActionSave->setEnabled( mModified );
if ( modified )
mJumpButtonBar->recreateButtons();
mViewManager->refreshView();
}
bool KABCore::modified() const
{
return mModified;
}
void KABCore::contactModified( const KABC::Addressee &addr )
{
addrModified( addr );
#if 0 // debug only
KABC::Addressee ad = addr;
ad.computeCsum( "123");
#endif
}
void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
{
Command *command = 0;
QString uid;
// check if it exists already
KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
if ( origAddr.isEmpty() )
command = new PwNewCommand( mAddressBook, addr );
else {
command = new PwEditCommand( mAddressBook, origAddr, addr );
uid = addr.uid();
}
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
if ( updateDetails )
mDetails->setAddressee( addr );
setModified( true );
}
void KABCore::newContact()
{
QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
QPtrList<KRES::Resource> kresResources;
QPtrListIterator<KABC::Resource> it( kabcResources );
KABC::Resource *resource;
while ( ( resource = it.current() ) != 0 ) {
++it;
if ( !resource->readOnly() ) {
KRES::Resource *res = static_cast<KRES::Resource*>( resource );
if ( res )
kresResources.append( res );
}
}
KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
resource = static_cast<KABC::Resource*>( res );
if ( resource ) {
KABC::Addressee addr;
addr.setResource( resource );
mEditorDialog->setAddressee( addr );
+ mEditorDialog->setCaption( i18n("Edit new contact"));
KApplication::execDialog ( mEditorDialog );
} else
return;
// mEditorDict.insert( dialog->addressee().uid(), dialog );
}
void KABCore::addEmail( QString aStr )
{
#ifndef KAB_EMBEDDED
QString fullName, email;
KABC::Addressee::parseEmailAddress( aStr, fullName, email );
// Try to lookup the addressee matching the email address
bool found = false;
QStringList emailList;
KABC::AddressBook::Iterator it;
for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
emailList = (*it).emails();
if ( emailList.contains( email ) > 0 ) {
found = true;
(*it).setNameFromString( fullName );
editContact( (*it).uid() );
}
}
if ( !found ) {
KABC::Addressee addr;
addr.setNameFromString( fullName );
addr.insertEmail( email, true );
mAddressBook->insertAddressee( addr );
mViewManager->refreshView( addr.uid() );
editContact( addr.uid() );
}
#else //KAB_EMBEDDED
qDebug("KABCore::addEmail finsih method");
#endif //KAB_EMBEDDED
}
void KABCore::importVCard( const KURL &url, bool showPreview )
{
mXXPortManager->importVCard( url, showPreview );
}
void KABCore::importFromOL()
{
#ifdef _OL_IMPORT_
KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
idgl->exec();
KABC::Addressee::List list = idgl->getAddressList();
if ( list.count() > 0 ) {
KABC::Addressee::List listNew;
KABC::Addressee::List listExisting;
KABC::Addressee::List::Iterator it;
KABC::AddressBook::Iterator iter;
for ( it = list.begin(); it != list.end(); ++it ) {
if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
listNew.append( (*it) );
else
listExisting.append( (*it) );
}
if ( listExisting.count() > 0 )
KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
if ( listNew.count() > 0 ) {
pasteWithNewUid = false;
pasteContacts( listNew );
pasteWithNewUid = true;
}
}
delete idgl;
#endif
}
void KABCore::importVCard( const QString &vCard, bool showPreview )
{
mXXPortManager->importVCard( vCard, showPreview );
}
//US added a second method without defaultparameter
void KABCore::editContact2() {
editContact( QString::null );
}
void KABCore::editContact( const QString &uid )
{
if ( mExtensionManager->isQuickEditVisible() )
return;
// First, locate the contact entry
QString localUID = uid;
if ( localUID.isNull() ) {