|
|
@ -35,11 +35,11 @@
|
|
|
|
#include <tdeabc/distributionlist.h>
|
|
|
|
#include <tdeabc/distributionlist.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "addresspicker.h"
|
|
|
|
#include "addresspicker.h"
|
|
|
|
#include "KWMailMergeKABC.h"
|
|
|
|
#include "KWMailMergeTDEABC.h"
|
|
|
|
#include "KWMailMergeKABCConfig.h"
|
|
|
|
#include "KWMailMergeTDEABCConfig.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfig::KWMailMergeKABCConfig( TQWidget *parent, KWMailMergeKABC *db_)
|
|
|
|
KWMailMergeTDEABCConfig::KWMailMergeTDEABCConfig( TQWidget *parent, KWMailMergeTDEABC *db_)
|
|
|
|
:KDialogBase( Plain, i18n( "Mail Merge - Editor" ),
|
|
|
|
:KDialogBase( Plain, i18n( "Mail Merge - Editor" ),
|
|
|
|
Ok | Cancel, Ok, parent, "", true)
|
|
|
|
Ok | Cancel, Ok, parent, "", true)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -55,13 +55,13 @@ KWMailMergeKABCConfig::KWMailMergeKABCConfig( TQWidget *parent, KWMailMergeKABC
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfig::~KWMailMergeKABCConfig()
|
|
|
|
KWMailMergeTDEABCConfig::~KWMailMergeTDEABCConfig()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
;
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::acceptSelection()
|
|
|
|
void KWMailMergeTDEABCConfig::acceptSelection()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_db->clear();
|
|
|
|
_db->clear();
|
|
|
|
|
|
|
|
|
|
|
@ -95,7 +95,7 @@ void KWMailMergeKABCConfig::acceptSelection()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::addSelectedContacts()
|
|
|
|
void KWMailMergeTDEABCConfig::addSelectedContacts()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQListViewItemIterator it( _ui->mAvailableView, TQListViewItemIterator::Selected );
|
|
|
|
TQListViewItemIterator it( _ui->mAvailableView, TQListViewItemIterator::Selected );
|
|
|
|
TQListViewItem* selected = _ui->mSelectedView->findItem(
|
|
|
|
TQListViewItem* selected = _ui->mSelectedView->findItem(
|
|
|
@ -110,8 +110,8 @@ void KWMailMergeKABCConfig::addSelectedContacts()
|
|
|
|
kdDebug() << "addSelectedContacts(): uid :" << uid << endl;
|
|
|
|
kdDebug() << "addSelectedContacts(): uid :" << uid << endl;
|
|
|
|
if( !uid.isEmpty() )
|
|
|
|
if( !uid.isEmpty() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem *item =
|
|
|
|
KWMailMergeTDEABCConfigListItem *item =
|
|
|
|
static_cast<KWMailMergeKABCConfigListItem*> ( it.current() );
|
|
|
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( it.current() );
|
|
|
|
if( selected )
|
|
|
|
if( selected )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
selected->insertItem( item );
|
|
|
|
selected->insertItem( item );
|
|
|
@ -134,7 +134,7 @@ void KWMailMergeKABCConfig::addSelectedContacts()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::destroyAvailableClones( const TQString& uid )
|
|
|
|
void KWMailMergeTDEABCConfig::destroyAvailableClones( const TQString& uid )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( uid.isEmpty() )
|
|
|
|
if( uid.isEmpty() )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -155,9 +155,9 @@ void KWMailMergeKABCConfig::destroyAvailableClones( const TQString& uid )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::filterChanged( const TQString& txt )
|
|
|
|
void KWMailMergeTDEABCConfig::filterChanged( const TQString& txt )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kdDebug() << "KWMailMergeKABCConfig::filterChanged( " << txt << " )" << endl;
|
|
|
|
kdDebug() << "KWMailMergeTDEABCConfig::filterChanged( " << txt << " )" << endl;
|
|
|
|
|
|
|
|
|
|
|
|
bool showAll = txt.isEmpty();
|
|
|
|
bool showAll = txt.isEmpty();
|
|
|
|
|
|
|
|
|
|
|
@ -190,7 +190,7 @@ void KWMailMergeKABCConfig::filterChanged( const TQString& txt )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::initSelectedAddressees()
|
|
|
|
void KWMailMergeTDEABCConfig::initSelectedAddressees()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList records = _db->singleRecords();
|
|
|
|
TQStringList records = _db->singleRecords();
|
|
|
|
|
|
|
|
|
|
|
@ -201,14 +201,14 @@ void KWMailMergeKABCConfig::initSelectedAddressees()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( category->text(0) != i18n("Distribution Lists") )
|
|
|
|
if( category->text(0) != i18n("Distribution Lists") )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem* item =
|
|
|
|
KWMailMergeTDEABCConfigListItem* item =
|
|
|
|
static_cast<KWMailMergeKABCConfigListItem*> ( category->firstChild() );
|
|
|
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( category->firstChild() );
|
|
|
|
while( item && (records.count()>0) )
|
|
|
|
while( item && (records.count()>0) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Need some temporary item, because after selected->insertItem( item )
|
|
|
|
// Need some temporary item, because after selected->insertItem( item )
|
|
|
|
// the item->nextSibling() is not the one we want.
|
|
|
|
// the item->nextSibling() is not the one we want.
|
|
|
|
KWMailMergeKABCConfigListItem* nextItem =
|
|
|
|
KWMailMergeTDEABCConfigListItem* nextItem =
|
|
|
|
static_cast<KWMailMergeKABCConfigListItem*> ( item->nextSibling() );
|
|
|
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( item->nextSibling() );
|
|
|
|
|
|
|
|
|
|
|
|
for( TQStringList::Iterator itRecords = records.begin();
|
|
|
|
for( TQStringList::Iterator itRecords = records.begin();
|
|
|
|
itRecords != records.end(); ++itRecords )
|
|
|
|
itRecords != records.end(); ++itRecords )
|
|
|
@ -233,7 +233,7 @@ void KWMailMergeKABCConfig::initSelectedAddressees()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::initSelectedLists()
|
|
|
|
void KWMailMergeTDEABCConfig::initSelectedLists()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList lists = _db->lists();
|
|
|
|
TQStringList lists = _db->lists();
|
|
|
|
|
|
|
|
|
|
|
@ -265,7 +265,7 @@ void KWMailMergeKABCConfig::initSelectedLists()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::initSlotSignalConnections()
|
|
|
|
void KWMailMergeTDEABCConfig::initSlotSignalConnections()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
connect( this, TQT_SIGNAL( okClicked() ), TQT_SLOT( acceptSelection() ) );
|
|
|
|
connect( this, TQT_SIGNAL( okClicked() ), TQT_SLOT( acceptSelection() ) );
|
|
|
|
connect( _ui->mAddButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addSelectedContacts() ) );
|
|
|
|
connect( _ui->mAddButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addSelectedContacts() ) );
|
|
|
@ -283,14 +283,14 @@ void KWMailMergeKABCConfig::initSlotSignalConnections()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::launchAddressbook() const
|
|
|
|
void KWMailMergeTDEABCConfig::launchAddressbook() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kapp->startServiceByDesktopName( "kaddressbook", TQString() );
|
|
|
|
kapp->startServiceByDesktopName( "kaddressbook", TQString() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::removeContact( TQListViewItem* item )
|
|
|
|
void KWMailMergeTDEABCConfig::removeContact( TQListViewItem* item )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList& categories = _usedCategories;
|
|
|
|
TQStringList& categories = _usedCategories;
|
|
|
|
TQListViewItem* availableLists = _ui->mAvailableView->findItem(
|
|
|
|
TQListViewItem* availableLists = _ui->mAvailableView->findItem(
|
|
|
@ -299,8 +299,8 @@ void KWMailMergeKABCConfig::removeContact( TQListViewItem* item )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !item->text( -1 ).isEmpty() ) // remove selected single entry here
|
|
|
|
if( !item->text( -1 ).isEmpty() ) // remove selected single entry here
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem* rightItem =
|
|
|
|
KWMailMergeTDEABCConfigListItem* rightItem =
|
|
|
|
static_cast<KWMailMergeKABCConfigListItem*> ( item );
|
|
|
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( item );
|
|
|
|
|
|
|
|
|
|
|
|
TQStringList entryCategories = rightItem->addressee().categories();
|
|
|
|
TQStringList entryCategories = rightItem->addressee().categories();
|
|
|
|
for ( TQStringList::Iterator itEntryCat = entryCategories.begin();
|
|
|
|
for ( TQStringList::Iterator itEntryCat = entryCategories.begin();
|
|
|
@ -313,13 +313,13 @@ void KWMailMergeKABCConfig::removeContact( TQListViewItem* item )
|
|
|
|
*itEntryCat );
|
|
|
|
*itEntryCat );
|
|
|
|
categories.append( *itEntryCat );
|
|
|
|
categories.append( *itEntryCat );
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfigListItem* leftItem = new KWMailMergeKABCConfigListItem(
|
|
|
|
KWMailMergeTDEABCConfigListItem* leftItem = new KWMailMergeTDEABCConfigListItem(
|
|
|
|
category, rightItem->addressee() );
|
|
|
|
category, rightItem->addressee() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem* leftItem = new
|
|
|
|
KWMailMergeTDEABCConfigListItem* leftItem = new
|
|
|
|
KWMailMergeKABCConfigListItem(
|
|
|
|
KWMailMergeTDEABCConfigListItem(
|
|
|
|
_ui->mAvailableView->findItem(
|
|
|
|
_ui->mAvailableView->findItem(
|
|
|
|
*itEntryCat, 0,
|
|
|
|
*itEntryCat, 0,
|
|
|
|
TQt::ExactMatch),
|
|
|
|
TQt::ExactMatch),
|
|
|
@ -329,7 +329,7 @@ void KWMailMergeKABCConfig::removeContact( TQListViewItem* item )
|
|
|
|
if( entryCategories.isEmpty() )
|
|
|
|
if( entryCategories.isEmpty() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQString noCat = i18n("no category");
|
|
|
|
TQString noCat = i18n("no category");
|
|
|
|
KWMailMergeKABCConfigListItem* leftItem = new KWMailMergeKABCConfigListItem(
|
|
|
|
KWMailMergeTDEABCConfigListItem* leftItem = new KWMailMergeTDEABCConfigListItem(
|
|
|
|
_ui->mAvailableView->findItem(
|
|
|
|
_ui->mAvailableView->findItem(
|
|
|
|
noCat, 0, TQt::ExactMatch),
|
|
|
|
noCat, 0, TQt::ExactMatch),
|
|
|
|
rightItem->addressee() );
|
|
|
|
rightItem->addressee() );
|
|
|
@ -344,7 +344,7 @@ void KWMailMergeKABCConfig::removeContact( TQListViewItem* item )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::removeSelectedContacts()
|
|
|
|
void KWMailMergeTDEABCConfig::removeSelectedContacts()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQListViewItemIterator it( _ui->mSelectedView, TQListViewItemIterator::Selected );
|
|
|
|
TQListViewItemIterator it( _ui->mSelectedView, TQListViewItemIterator::Selected );
|
|
|
|
|
|
|
|
|
|
|
@ -358,7 +358,7 @@ void KWMailMergeKABCConfig::removeSelectedContacts()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::saveDistributionList()
|
|
|
|
void KWMailMergeTDEABCConfig::saveDistributionList()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TDEABC::DistributionListManager dlm( TDEABC::StdAddressBook::self() );
|
|
|
|
TDEABC::DistributionListManager dlm( TDEABC::StdAddressBook::self() );
|
|
|
|
dlm.load();
|
|
|
|
dlm.load();
|
|
|
@ -389,8 +389,8 @@ void KWMailMergeKABCConfig::saveDistributionList()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( category->text(0)==i18n("Single Entries") )
|
|
|
|
if( category->text(0)==i18n("Single Entries") )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem* item =
|
|
|
|
KWMailMergeTDEABCConfigListItem* item =
|
|
|
|
static_cast<KWMailMergeKABCConfigListItem*> ( category->firstChild() );
|
|
|
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( category->firstChild() );
|
|
|
|
|
|
|
|
|
|
|
|
while(item)
|
|
|
|
while(item)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -402,7 +402,7 @@ void KWMailMergeKABCConfig::saveDistributionList()
|
|
|
|
newListItem, item->addressee().formattedName() );
|
|
|
|
newListItem, item->addressee().formattedName() );
|
|
|
|
newItem->setEnabled( false );
|
|
|
|
newItem->setEnabled( false );
|
|
|
|
|
|
|
|
|
|
|
|
item = static_cast<KWMailMergeKABCConfigListItem*>( item->nextSibling() );
|
|
|
|
item = static_cast<KWMailMergeTDEABCConfigListItem*>( item->nextSibling() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQListViewItemIterator it ( category->firstChild() );
|
|
|
|
TQListViewItemIterator it ( category->firstChild() );
|
|
|
@ -420,7 +420,7 @@ void KWMailMergeKABCConfig::saveDistributionList()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KWMailMergeKABCConfig::updateAvailable()
|
|
|
|
void KWMailMergeTDEABCConfig::updateAvailable()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_ui->mAvailableView->clear();
|
|
|
|
_ui->mAvailableView->clear();
|
|
|
|
_ui->mAvailableView->setRootIsDecorated( true );
|
|
|
|
_ui->mAvailableView->setRootIsDecorated( true );
|
|
|
@ -451,13 +451,13 @@ void KWMailMergeKABCConfig::updateAvailable()
|
|
|
|
TQListViewItem* category = new TQListViewItem( _ui->mAvailableView, *itCat );
|
|
|
|
TQListViewItem* category = new TQListViewItem( _ui->mAvailableView, *itCat );
|
|
|
|
categories.append( *itCat );
|
|
|
|
categories.append( *itCat );
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfigListItem* item = new KWMailMergeKABCConfigListItem(
|
|
|
|
KWMailMergeTDEABCConfigListItem* item = new KWMailMergeTDEABCConfigListItem(
|
|
|
|
category, *itAddr );
|
|
|
|
category, *itAddr );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Append item to existing category in listview.
|
|
|
|
// Append item to existing category in listview.
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem* item = new KWMailMergeKABCConfigListItem(
|
|
|
|
KWMailMergeTDEABCConfigListItem* item = new KWMailMergeTDEABCConfigListItem(
|
|
|
|
_ui->mAvailableView->findItem(
|
|
|
|
_ui->mAvailableView->findItem(
|
|
|
|
*itCat, 0, TQt::ExactMatch),
|
|
|
|
*itCat, 0, TQt::ExactMatch),
|
|
|
|
*itAddr );
|
|
|
|
*itAddr );
|
|
|
@ -467,7 +467,7 @@ void KWMailMergeKABCConfig::updateAvailable()
|
|
|
|
// If Addressee does not belong to any category, append it to "no category".
|
|
|
|
// If Addressee does not belong to any category, append it to "no category".
|
|
|
|
if( entryCategories.isEmpty() )
|
|
|
|
if( entryCategories.isEmpty() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KWMailMergeKABCConfigListItem* item = new KWMailMergeKABCConfigListItem(
|
|
|
|
KWMailMergeTDEABCConfigListItem* item = new KWMailMergeTDEABCConfigListItem(
|
|
|
|
noCategory, *itAddr );
|
|
|
|
noCategory, *itAddr );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -509,29 +509,29 @@ void KWMailMergeKABCConfig::updateAvailable()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfigListItem::KWMailMergeKABCConfigListItem( TQListView *parent,
|
|
|
|
KWMailMergeTDEABCConfigListItem::KWMailMergeTDEABCConfigListItem( TQListView *parent,
|
|
|
|
const TDEABC::Addressee& addressEntry ) : TQListViewItem( parent )
|
|
|
|
const TDEABC::Addressee& addressEntry ) : TQListViewItem( parent )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setText( 0, addressEntry.formattedName() );
|
|
|
|
setText( 0, addressEntry.formattedName() );
|
|
|
|
_addressEntry = addressEntry;
|
|
|
|
_addressEntry = addressEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfigListItem::KWMailMergeKABCConfigListItem( TQListViewItem *parent,
|
|
|
|
KWMailMergeTDEABCConfigListItem::KWMailMergeTDEABCConfigListItem( TQListViewItem *parent,
|
|
|
|
const TDEABC::Addressee& addressEntry ) : TQListViewItem( parent )
|
|
|
|
const TDEABC::Addressee& addressEntry ) : TQListViewItem( parent )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setText( 0, addressEntry.formattedName() );
|
|
|
|
setText( 0, addressEntry.formattedName() );
|
|
|
|
_addressEntry = addressEntry;
|
|
|
|
_addressEntry = addressEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KWMailMergeKABCConfigListItem::~KWMailMergeKABCConfigListItem()
|
|
|
|
KWMailMergeTDEABCConfigListItem::~KWMailMergeTDEABCConfigListItem()
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
TDEABC::Addressee KWMailMergeKABCConfigListItem::addressee() const
|
|
|
|
TDEABC::Addressee KWMailMergeTDEABCConfigListItem::addressee() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _addressEntry;
|
|
|
|
return _addressEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString KWMailMergeKABCConfigListItem::text( int column ) const
|
|
|
|
TQString KWMailMergeTDEABCConfigListItem::text( int column ) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( column == -1 )
|
|
|
|
if( column == -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -543,4 +543,4 @@ TQString KWMailMergeKABCConfigListItem::text( int column ) const
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "KWMailMergeKABCConfig.moc"
|
|
|
|
#include "KWMailMergeTDEABCConfig.moc"
|