|
|
|
@ -39,7 +39,7 @@
|
|
|
|
|
#include <kmessagebox.h>
|
|
|
|
|
|
|
|
|
|
#include <kabc/addresseedialog.h>
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#include <libtdepim/distributionlist.h>
|
|
|
|
|
typedef KPIM::DistributionList DistributionList;
|
|
|
|
|
#else
|
|
|
|
@ -149,7 +149,7 @@ class ContactItem : public TQListViewItem
|
|
|
|
|
DistributionListWidget::DistributionListWidget( KAB::Core *core, TQWidget *parent,
|
|
|
|
|
const char *name )
|
|
|
|
|
: KAB::ExtensionWidget( core, parent, name )
|
|
|
|
|
#ifndef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifndef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
, mManager( 0 )
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
@ -201,7 +201,7 @@ DistributionListWidget::DistributionListWidget( KAB::Core *core, TQWidget *paren
|
|
|
|
|
topLayout->addWidget( mRemoveContactButton, 2, 3 );
|
|
|
|
|
connect( mRemoveContactButton, TQT_SIGNAL( clicked() ), TQT_SLOT( removeContact() ) );
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
// When contacts are changed, update both distr list combo and contents of displayed distr list
|
|
|
|
|
connect( core, TQT_SIGNAL( contactsUpdated() ),
|
|
|
|
|
this, TQT_SLOT( updateNameCombo() ) );
|
|
|
|
@ -228,7 +228,7 @@ DistributionListWidget::DistributionListWidget( KAB::Core *core, TQWidget *paren
|
|
|
|
|
|
|
|
|
|
DistributionListWidget::~DistributionListWidget()
|
|
|
|
|
{
|
|
|
|
|
#ifndef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifndef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
delete mManager;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -237,7 +237,7 @@ DistributionListWidget::~DistributionListWidget()
|
|
|
|
|
|
|
|
|
|
void DistributionListWidget::save()
|
|
|
|
|
{
|
|
|
|
|
#ifndef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifndef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
mManager->save();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -254,7 +254,7 @@ void DistributionListWidget::selectionContactViewChanged()
|
|
|
|
|
|
|
|
|
|
bool DistributionListWidget::alreadyExists( const TQString& distrListName ) const
|
|
|
|
|
{
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
return core()->distributionListNames().contains( distrListName );
|
|
|
|
|
#else
|
|
|
|
|
return mManager->listNames().contains( distrListName );
|
|
|
|
@ -273,7 +273,7 @@ void DistributionListWidget::createList()
|
|
|
|
|
KMessageBox::sorry( this, i18n( "The name already exists" ) );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KABC::Resource* resource = core()->requestResource( this );
|
|
|
|
|
if ( !resource )
|
|
|
|
|
return;
|
|
|
|
@ -313,7 +313,7 @@ void DistributionListWidget::editList()
|
|
|
|
|
KMessageBox::sorry( this, i18n( "The name already exists." ) );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist = KPIM::DistributionList::findByName(
|
|
|
|
|
core()->addressBook(), mNameCombo->currentText() );
|
|
|
|
|
if ( dist.isEmpty() ) // not found [should be impossible]
|
|
|
|
@ -335,7 +335,7 @@ void DistributionListWidget::editList()
|
|
|
|
|
// Display the contents of the list we just selected
|
|
|
|
|
updateContactView();
|
|
|
|
|
|
|
|
|
|
#ifndef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifndef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
changed();
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
@ -349,7 +349,7 @@ void DistributionListWidget::removeList()
|
|
|
|
|
if ( result != KMessageBox::Continue )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist = KPIM::DistributionList::findByName(
|
|
|
|
|
core()->addressBook(), mNameCombo->currentText() );
|
|
|
|
|
if ( dist.isEmpty() ) // not found [should be impossible]
|
|
|
|
@ -369,7 +369,7 @@ void DistributionListWidget::removeList()
|
|
|
|
|
|
|
|
|
|
void DistributionListWidget::addContact()
|
|
|
|
|
{
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist = KPIM::DistributionList::findByName(
|
|
|
|
|
core()->addressBook(), mNameCombo->currentText() );
|
|
|
|
|
if ( dist.isEmpty() ) { // not found
|
|
|
|
@ -388,7 +388,7 @@ void DistributionListWidget::addContact()
|
|
|
|
|
for ( it = addrList.begin(); it != addrList.end(); ++it )
|
|
|
|
|
dist.insertEntry( *it );
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
core()->addressBook()->insertAddressee( dist );
|
|
|
|
|
changed( dist );
|
|
|
|
|
#else
|
|
|
|
@ -399,7 +399,7 @@ void DistributionListWidget::addContact()
|
|
|
|
|
|
|
|
|
|
void DistributionListWidget::removeContact()
|
|
|
|
|
{
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist = KPIM::DistributionList::findByName(
|
|
|
|
|
core()->addressBook(), mNameCombo->currentText() );
|
|
|
|
|
if ( dist.isEmpty() ) // not found
|
|
|
|
@ -419,7 +419,7 @@ void DistributionListWidget::removeContact()
|
|
|
|
|
dist.removeEntry( contactItem->addressee(), contactItem->email() );
|
|
|
|
|
delete contactItem;
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
core()->addressBook()->insertAddressee( dist );
|
|
|
|
|
changed( dist );
|
|
|
|
|
#else
|
|
|
|
@ -429,7 +429,7 @@ void DistributionListWidget::removeContact()
|
|
|
|
|
|
|
|
|
|
void DistributionListWidget::changeEmail()
|
|
|
|
|
{
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist = KPIM::DistributionList::findByName(
|
|
|
|
|
core()->addressBook(), mNameCombo->currentText() );
|
|
|
|
|
if ( dist.isEmpty() ) // not found
|
|
|
|
@ -454,7 +454,7 @@ void DistributionListWidget::changeEmail()
|
|
|
|
|
dist.removeEntry( contactItem->addressee(), contactItem->email() );
|
|
|
|
|
dist.insertEntry( contactItem->addressee(), email );
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
core()->addressBook()->insertAddressee( dist );
|
|
|
|
|
changed( dist );
|
|
|
|
|
#else
|
|
|
|
@ -468,7 +468,7 @@ void DistributionListWidget::updateContactView()
|
|
|
|
|
mContactView->clear();
|
|
|
|
|
|
|
|
|
|
bool isListSelected = false;
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist;
|
|
|
|
|
if ( mNameCombo->count() != 0 )
|
|
|
|
|
dist = KPIM::DistributionList::findByName(
|
|
|
|
@ -491,7 +491,7 @@ void DistributionListWidget::updateContactView()
|
|
|
|
|
mContactView->setEnabled( true );
|
|
|
|
|
|
|
|
|
|
uint entryCount = 0;
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
const KPIM::DistributionList::Entry::List entries = dist.entries( core()->addressBook() );
|
|
|
|
|
KPIM::DistributionList::Entry::List::ConstIterator it;
|
|
|
|
|
#else
|
|
|
|
@ -512,7 +512,7 @@ void DistributionListWidget::updateNameCombo()
|
|
|
|
|
{
|
|
|
|
|
int pos = mNameCombo->currentItem();
|
|
|
|
|
mNameCombo->clear();
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
const TQStringList names = core()->distributionListNames();
|
|
|
|
|
#else
|
|
|
|
|
mManager->load();
|
|
|
|
@ -529,7 +529,7 @@ void DistributionListWidget::dropEvent( TQDropEvent *e )
|
|
|
|
|
if ( mNameCombo->count() == 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
KPIM::DistributionList dist = KPIM::DistributionList::findByName(
|
|
|
|
|
core()->addressBook(), mNameCombo->currentText() );
|
|
|
|
|
if ( dist.isEmpty() )
|
|
|
|
@ -548,7 +548,7 @@ void DistributionListWidget::dropEvent( TQDropEvent *e )
|
|
|
|
|
for ( KABC::Addressee::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
|
|
|
|
|
dist.insertEntry( *it );
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
core()->addressBook()->insertAddressee( dist );
|
|
|
|
|
changed( dist );
|
|
|
|
|
#else
|
|
|
|
@ -578,7 +578,7 @@ void DistributionListWidget::dropped( TQDropEvent *e, TQListViewItem* )
|
|
|
|
|
dropEvent( e );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef KDEPIM_NEW_DISTRLISTS
|
|
|
|
|
#ifdef TDEPIM_NEW_DISTRLISTS
|
|
|
|
|
void DistributionListWidget::changed( const KABC::Addressee& dist )
|
|
|
|
|
{
|
|
|
|
|
emit modified( KABC::Addressee::List() << dist );
|
|
|
|
|