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