You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
547 lines
18 KiB
547 lines
18 KiB
15 years ago
|
/*
|
||
|
This file is part of the KDE project
|
||
|
Copyright (C) 2004 Dirk Schmidt <fs@dirk-schmidt.net>
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU Library General Public
|
||
|
License as published by the Free Software Foundation; either
|
||
|
version 2 of the License, or (at your option) any later version.
|
||
|
|
||
|
This library is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
Library General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU Library General Public License
|
||
|
along with this library; see the file COPYING.LIB. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
|
||
14 years ago
|
#include <tqvbox.h>
|
||
13 years ago
|
#include <tqlayout.h>
|
||
14 years ago
|
#include <tqlineedit.h>
|
||
15 years ago
|
|
||
12 years ago
|
#include <tdeapplication.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
12 years ago
|
#include <tdeglobal.h>
|
||
15 years ago
|
#include <kinputdialog.h>
|
||
12 years ago
|
#include <tdelocale.h>
|
||
|
#include <tdemessagebox.h>
|
||
15 years ago
|
#include <kpushbutton.h>
|
||
|
#include <krun.h>
|
||
12 years ago
|
#include <tdeabc/stdaddressbook.h>
|
||
|
#include <tdeabc/distributionlist.h>
|
||
15 years ago
|
|
||
|
#include "addresspicker.h"
|
||
12 years ago
|
#include "KWMailMergeTDEABC.h"
|
||
|
#include "KWMailMergeTDEABCConfig.h"
|
||
15 years ago
|
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfig::KWMailMergeTDEABCConfig( TQWidget *parent, KWMailMergeTDEABC *db_)
|
||
15 years ago
|
:KDialogBase( Plain, i18n( "Mail Merge - Editor" ),
|
||
14 years ago
|
Ok | Cancel, Ok, parent, "", true)
|
||
15 years ago
|
{
|
||
|
_db = db_;
|
||
|
|
||
14 years ago
|
(new TQVBoxLayout(plainPage()))->setAutoAdd(true);
|
||
15 years ago
|
setMainWidget( _ui=new AddressPickerUI( plainPage() ) );
|
||
|
|
||
|
updateAvailable();
|
||
|
initSelectedAddressees();
|
||
|
initSelectedLists();
|
||
|
initSlotSignalConnections();
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfig::~KWMailMergeTDEABCConfig()
|
||
15 years ago
|
{
|
||
|
;
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::acceptSelection()
|
||
15 years ago
|
{
|
||
|
_db->clear();
|
||
|
|
||
14 years ago
|
TQListViewItem* top = _ui->mSelectedView->firstChild();
|
||
15 years ago
|
while(top)
|
||
|
{
|
||
|
kdDebug() << "acceptSelection(): " << top->text(0) << endl;
|
||
|
if( top->text(0) == i18n("Distribution Lists") )
|
||
|
{
|
||
14 years ago
|
TQListViewItem* item = top->firstChild();
|
||
15 years ago
|
while(item)
|
||
|
{
|
||
|
kdDebug() << "acceptSelection(): " << item->text(0) << endl;
|
||
|
_db->addList( item->text(0) );
|
||
|
item = item->nextSibling();
|
||
|
}
|
||
|
}
|
||
|
else if( top->text(0) == i18n("Single Entries") )
|
||
|
{
|
||
14 years ago
|
TQListViewItem* item = top->firstChild();
|
||
15 years ago
|
while(item)
|
||
|
{
|
||
|
kdDebug() << "acceptSelection(): " << item->text(0) << endl;
|
||
|
_db->addEntry( item->text(-1) );
|
||
|
item = item->nextSibling();
|
||
|
}
|
||
|
}
|
||
|
top = top->nextSibling();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::addSelectedContacts()
|
||
15 years ago
|
{
|
||
14 years ago
|
TQListViewItemIterator it( _ui->mAvailableView, TQListViewItemIterator::Selected );
|
||
14 years ago
|
TQListViewItem* selected = _ui->mSelectedView->findItem(
|
||
14 years ago
|
i18n("Single Entries"), 0, TQt::ExactMatch );
|
||
14 years ago
|
TQListViewItem* selectedLists = _ui->mSelectedView->findItem(
|
||
14 years ago
|
i18n("Distribution Lists"), 0, TQt::ExactMatch );
|
||
15 years ago
|
while ( it.current() )
|
||
|
{
|
||
|
if( it.current()->depth() > 0 )
|
||
|
{
|
||
14 years ago
|
TQString uid = it.current()->text( -1 );
|
||
15 years ago
|
kdDebug() << "addSelectedContacts(): uid :" << uid << endl;
|
||
|
if( !uid.isEmpty() )
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem *item =
|
||
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( it.current() );
|
||
15 years ago
|
if( selected )
|
||
|
{
|
||
|
selected->insertItem( item );
|
||
|
selected->setOpen( true );
|
||
|
destroyAvailableClones( uid );
|
||
|
}
|
||
|
}
|
||
14 years ago
|
else if( it.current()->parent()->text(0) == i18n("Distribution Lists") )
|
||
15 years ago
|
{
|
||
|
if( selectedLists )
|
||
|
{
|
||
|
selectedLists->insertItem( it.current() );
|
||
|
selectedLists->setOpen( true );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
++it;
|
||
|
}
|
||
|
_ui->mSelectedView->selectAll( false );
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::destroyAvailableClones( const TQString& uid )
|
||
15 years ago
|
{
|
||
|
if( uid.isEmpty() )
|
||
|
return;
|
||
|
|
||
14 years ago
|
TQListViewItemIterator it( _ui->mAvailableView );
|
||
15 years ago
|
|
||
|
while ( it.current() )
|
||
|
{
|
||
|
if( it.current()->depth() > 0)
|
||
|
{
|
||
|
if( it.current()->text(-1)== uid )
|
||
|
{
|
||
|
delete it.current();
|
||
|
}
|
||
|
}
|
||
|
++it;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::filterChanged( const TQString& txt )
|
||
15 years ago
|
{
|
||
12 years ago
|
kdDebug() << "KWMailMergeTDEABCConfig::filterChanged( " << txt << " )" << endl;
|
||
15 years ago
|
|
||
|
bool showAll = txt.isEmpty();
|
||
|
|
||
14 years ago
|
TQListViewItem* category = _ui->mAvailableView->firstChild();
|
||
15 years ago
|
while(category)
|
||
|
{
|
||
|
if( category->text(0)!=i18n("Distribution Lists") )
|
||
|
{
|
||
14 years ago
|
TQListViewItem* item = category->firstChild();
|
||
15 years ago
|
while(item)
|
||
|
{
|
||
|
if(showAll)
|
||
|
{
|
||
|
item->setVisible( true );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
14 years ago
|
item->setVisible( item->text(0).contains( txt, false ) );
|
||
15 years ago
|
}
|
||
|
item = item->nextSibling();
|
||
|
}
|
||
|
category->setOpen( !showAll );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
category->setVisible( showAll );
|
||
|
}
|
||
|
category = category->nextSibling();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::initSelectedAddressees()
|
||
15 years ago
|
{
|
||
14 years ago
|
TQStringList records = _db->singleRecords();
|
||
15 years ago
|
|
||
14 years ago
|
TQListViewItem* category = _ui->mAvailableView->firstChild();
|
||
14 years ago
|
TQListViewItem* selected = _ui->mSelectedView->findItem(
|
||
14 years ago
|
i18n("Single Entries"), 0, TQt::ExactMatch );
|
||
15 years ago
|
while ( category && (records.count()>0) )
|
||
|
{
|
||
|
if( category->text(0) != i18n("Distribution Lists") )
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* item =
|
||
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( category->firstChild() );
|
||
15 years ago
|
while( item && (records.count()>0) )
|
||
|
{
|
||
|
// Need some temporary item, because after selected->insertItem( item )
|
||
|
// the item->nextSibling() is not the one we want.
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* nextItem =
|
||
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( item->nextSibling() );
|
||
15 years ago
|
|
||
14 years ago
|
for( TQStringList::Iterator itRecords = records.begin();
|
||
15 years ago
|
itRecords != records.end(); ++itRecords )
|
||
|
{
|
||
14 years ago
|
TQString uid = *itRecords;
|
||
15 years ago
|
if( item->text(-1) == uid )
|
||
|
{
|
||
|
selected->insertItem( item );
|
||
|
|
||
|
// downsize records to speed up iterations
|
||
|
itRecords = records.remove( itRecords );
|
||
|
--itRecords;
|
||
|
|
||
|
destroyAvailableClones( uid );
|
||
|
}
|
||
|
}
|
||
|
item = nextItem;
|
||
|
}
|
||
|
}
|
||
|
category = category->nextSibling();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::initSelectedLists()
|
||
15 years ago
|
{
|
||
14 years ago
|
TQStringList lists = _db->lists();
|
||
15 years ago
|
|
||
|
kdDebug() << "::initSelectedLists()" << lists.join(",") << endl;
|
||
|
|
||
14 years ago
|
TQListViewItem* l = _ui->mAvailableView->findItem(
|
||
14 years ago
|
i18n("Distribution Lists"), 0, TQt::ExactMatch );
|
||
14 years ago
|
TQListViewItem* selected = _ui->mSelectedView->findItem(
|
||
14 years ago
|
i18n("Distribution Lists"), 0, TQt::ExactMatch );
|
||
15 years ago
|
|
||
14 years ago
|
TQListViewItem* item = ( l->firstChild() );
|
||
15 years ago
|
while( item && (lists.count()>0) )
|
||
|
{
|
||
14 years ago
|
TQListViewItem* nextItem = item->nextSibling();
|
||
15 years ago
|
|
||
14 years ago
|
for( TQStringList::Iterator itLists = lists.begin();
|
||
15 years ago
|
itLists != lists.end(); ++itLists )
|
||
|
{
|
||
14 years ago
|
TQString id = *itLists;
|
||
15 years ago
|
if( item->text(0) == id )
|
||
|
{
|
||
|
selected->insertItem( item );
|
||
|
itLists = lists.remove( itLists );
|
||
|
--itLists;
|
||
|
}
|
||
|
}
|
||
|
item = nextItem;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::initSlotSignalConnections()
|
||
15 years ago
|
{
|
||
14 years ago
|
connect( this, TQT_SIGNAL( okClicked() ), TQT_SLOT( acceptSelection() ) );
|
||
|
connect( _ui->mAddButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addSelectedContacts() ) );
|
||
|
connect( _ui->mAddressBook, TQT_SIGNAL( clicked() ), TQT_SLOT( launchAddressbook() ) );
|
||
|
|
||
|
connect( _ui->mAvailableView, TQT_SIGNAL( doubleClicked( TQListViewItem *, const TQPoint &, int ) ),
|
||
|
TQT_SLOT( addSelectedContacts() ) );
|
||
|
|
||
|
connect( _ui->mFilterEdit, TQT_SIGNAL( textChanged(const TQString &) ),
|
||
|
TQT_SLOT( filterChanged(const TQString &) ) );
|
||
|
connect( _ui->mRemoveButton, TQT_SIGNAL( clicked() ), TQT_SLOT( removeSelectedContacts() ) );
|
||
|
connect( _ui->mSaveList, TQT_SIGNAL( clicked() ), TQT_SLOT( saveDistributionList() ) );
|
||
|
connect( _ui->mSelectedView, TQT_SIGNAL( doubleClicked( TQListViewItem *, const TQPoint &, int ) ),
|
||
|
TQT_SLOT( removeSelectedContacts() ) );
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::launchAddressbook() const
|
||
15 years ago
|
{
|
||
14 years ago
|
kapp->startServiceByDesktopName( "kaddressbook", TQString() );
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::removeContact( TQListViewItem* item )
|
||
15 years ago
|
{
|
||
14 years ago
|
TQStringList& categories = _usedCategories;
|
||
14 years ago
|
TQListViewItem* availableLists = _ui->mAvailableView->findItem(
|
||
14 years ago
|
i18n("Distribution Lists"), 0, TQt::ExactMatch );
|
||
15 years ago
|
if( item->depth() > 0 )
|
||
|
{
|
||
|
if( !item->text( -1 ).isEmpty() ) // remove selected single entry here
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* rightItem =
|
||
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( item );
|
||
15 years ago
|
|
||
14 years ago
|
TQStringList entryCategories = rightItem->addressee().categories();
|
||
|
for ( TQStringList::Iterator itEntryCat = entryCategories.begin();
|
||
15 years ago
|
itEntryCat != entryCategories.end(); ++itEntryCat )
|
||
|
{
|
||
14 years ago
|
int i = categories.findIndex(*itEntryCat);
|
||
15 years ago
|
if( i == -1 )
|
||
|
{
|
||
14 years ago
|
TQListViewItem* category = new TQListViewItem( _ui->mAvailableView,
|
||
15 years ago
|
*itEntryCat );
|
||
|
categories.append( *itEntryCat );
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* leftItem = new KWMailMergeTDEABCConfigListItem(
|
||
15 years ago
|
category, rightItem->addressee() );
|
||
|
}
|
||
|
else
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* leftItem = new
|
||
|
KWMailMergeTDEABCConfigListItem(
|
||
14 years ago
|
_ui->mAvailableView->findItem(
|
||
15 years ago
|
*itEntryCat, 0,
|
||
14 years ago
|
TQt::ExactMatch),
|
||
15 years ago
|
rightItem->addressee() );
|
||
|
}
|
||
|
}
|
||
|
if( entryCategories.isEmpty() )
|
||
|
{
|
||
14 years ago
|
TQString noCat = i18n("no category");
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* leftItem = new KWMailMergeTDEABCConfigListItem(
|
||
14 years ago
|
_ui->mAvailableView->findItem(
|
||
14 years ago
|
noCat, 0, TQt::ExactMatch),
|
||
15 years ago
|
rightItem->addressee() );
|
||
|
}
|
||
|
delete item;
|
||
|
}
|
||
14 years ago
|
else if( item->parent()->text(0) == i18n("Distribution Lists") ) // remove a list
|
||
15 years ago
|
{
|
||
|
if( availableLists )
|
||
|
availableLists->insertItem( item );
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::removeSelectedContacts()
|
||
15 years ago
|
{
|
||
14 years ago
|
TQListViewItemIterator it( _ui->mSelectedView, TQListViewItemIterator::Selected );
|
||
15 years ago
|
|
||
|
while( it.current() )
|
||
|
{
|
||
|
kdDebug() << "removeSelectedContacts(): text: " << it.current()->text(-1) << endl;
|
||
|
removeContact( it.current() );
|
||
|
++it;
|
||
|
}
|
||
|
_ui->mAvailableView->selectAll( false );
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::saveDistributionList()
|
||
15 years ago
|
{
|
||
12 years ago
|
TDEABC::DistributionListManager dlm( TDEABC::StdAddressBook::self() );
|
||
15 years ago
|
dlm.load();
|
||
|
|
||
|
bool ok = false;
|
||
14 years ago
|
TQString listName = KInputDialog::getText( i18n("New Distribution List"),
|
||
15 years ago
|
i18n("Please enter name:"),
|
||
14 years ago
|
TQString(), &ok,
|
||
15 years ago
|
this );
|
||
|
if ( !ok || listName.isEmpty() )
|
||
|
return;
|
||
|
|
||
|
if ( dlm.list( listName ) )
|
||
|
{
|
||
|
KMessageBox::information( 0,
|
||
|
i18n( "<qt>Distribution list with the given name <b>%1</b> "
|
||
|
"already exists. Please select a different name.</qt>" )
|
||
13 years ago
|
.arg( listName ) );
|
||
15 years ago
|
return;
|
||
|
}
|
||
12 years ago
|
TDEABC::DistributionList *distList = new TDEABC::DistributionList( &dlm, listName );
|
||
15 years ago
|
|
||
14 years ago
|
TQListViewItem* newListItem = new TQListViewItem( _ui->mSelectedView->findItem(
|
||
14 years ago
|
i18n("Distribution Lists"),0 , TQt::ExactMatch), listName );
|
||
15 years ago
|
|
||
14 years ago
|
TQListViewItem* category = _ui->mSelectedView->firstChild();
|
||
15 years ago
|
while(category)
|
||
|
{
|
||
|
if( category->text(0)==i18n("Single Entries") )
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* item =
|
||
|
static_cast<KWMailMergeTDEABCConfigListItem*> ( category->firstChild() );
|
||
15 years ago
|
|
||
|
while(item)
|
||
|
{
|
||
|
distList->insertEntry( item->addressee() );
|
||
|
|
||
12 years ago
|
TDEABC::Addressee addr = item->addressee();
|
||
14 years ago
|
TQString formattedName = addr.formattedName();
|
||
|
TQListViewItem* newItem = new TQListViewItem(
|
||
15 years ago
|
newListItem, item->addressee().formattedName() );
|
||
|
newItem->setEnabled( false );
|
||
|
|
||
12 years ago
|
item = static_cast<KWMailMergeTDEABCConfigListItem*>( item->nextSibling() );
|
||
15 years ago
|
}
|
||
|
|
||
14 years ago
|
TQListViewItemIterator it ( category->firstChild() );
|
||
15 years ago
|
while( it.current() )
|
||
|
{
|
||
|
removeContact( it.current() );
|
||
|
++it;
|
||
|
}
|
||
|
}
|
||
|
category = category->nextSibling();
|
||
|
}
|
||
|
|
||
|
dlm.save();
|
||
|
newListItem->setOpen( true );
|
||
|
}
|
||
|
|
||
|
|
||
12 years ago
|
void KWMailMergeTDEABCConfig::updateAvailable()
|
||
15 years ago
|
{
|
||
|
_ui->mAvailableView->clear();
|
||
|
_ui->mAvailableView->setRootIsDecorated( true );
|
||
|
|
||
|
//
|
||
|
// First append the addressees.
|
||
|
//
|
||
14 years ago
|
TQListViewItem* noCategory = new TQListViewItem( _ui->mAvailableView,
|
||
15 years ago
|
i18n("no category") );
|
||
|
|
||
14 years ago
|
TQStringList& categories = _usedCategories ;
|
||
15 years ago
|
categories.clear();
|
||
|
|
||
12 years ago
|
TDEABC::AddressBook *addressBook = TDEABC::StdAddressBook::self();
|
||
|
for( TDEABC::AddressBook::Iterator itAddr = addressBook->begin();
|
||
15 years ago
|
itAddr != addressBook->end(); ++itAddr )
|
||
|
{
|
||
|
|
||
14 years ago
|
TQStringList entryCategories = itAddr->categories();
|
||
|
for ( TQStringList::Iterator itCat = entryCategories.begin();
|
||
15 years ago
|
itCat != entryCategories.end(); ++itCat )
|
||
|
{
|
||
14 years ago
|
int i = categories.findIndex(*itCat);
|
||
15 years ago
|
|
||
|
// Create category, if not yet in listview and append item to it.
|
||
|
if( i == -1 )
|
||
|
{
|
||
14 years ago
|
TQListViewItem* category = new TQListViewItem( _ui->mAvailableView, *itCat );
|
||
15 years ago
|
categories.append( *itCat );
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* item = new KWMailMergeTDEABCConfigListItem(
|
||
15 years ago
|
category, *itAddr );
|
||
|
}
|
||
|
// Append item to existing category in listview.
|
||
|
else
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* item = new KWMailMergeTDEABCConfigListItem(
|
||
14 years ago
|
_ui->mAvailableView->findItem(
|
||
14 years ago
|
*itCat, 0, TQt::ExactMatch),
|
||
15 years ago
|
*itAddr );
|
||
|
}
|
||
|
|
||
|
}
|
||
|
// If Addressee does not belong to any category, append it to "no category".
|
||
|
if( entryCategories.isEmpty() )
|
||
|
{
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem* item = new KWMailMergeTDEABCConfigListItem(
|
||
15 years ago
|
noCategory, *itAddr );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//
|
||
|
// Now append the distribution lists
|
||
|
//
|
||
12 years ago
|
TDEABC::DistributionListManager dlm ( addressBook );
|
||
15 years ago
|
dlm.load();
|
||
|
|
||
14 years ago
|
TQStringList distributionLists = dlm.listNames();
|
||
|
TQListViewItem* distributionListsItem = new TQListViewItem( _ui->mAvailableView,
|
||
15 years ago
|
i18n("Distribution Lists") );
|
||
|
|
||
14 years ago
|
TQStringList::Iterator itDistributionLists;
|
||
15 years ago
|
|
||
|
for( itDistributionLists = distributionLists.begin();
|
||
|
itDistributionLists != distributionLists.end(); ++itDistributionLists )
|
||
|
{
|
||
12 years ago
|
TDEABC::DistributionList* list = dlm.list( *itDistributionLists );
|
||
15 years ago
|
|
||
12 years ago
|
TDEABC::DistributionList::Entry::List entries = list->entries();
|
||
15 years ago
|
|
||
14 years ago
|
TQListViewItem* listItem = new TQListViewItem( distributionListsItem,
|
||
15 years ago
|
*itDistributionLists );
|
||
|
|
||
12 years ago
|
TDEABC::DistributionList::Entry::List::Iterator itList;
|
||
15 years ago
|
for ( itList = entries.begin(); itList != entries.end(); ++itList )
|
||
|
{
|
||
14 years ago
|
// Create a normal TQListViewItem and disable it, because this is not a
|
||
15 years ago
|
// distribution-list-editor. KAddressbook should be used instead.
|
||
14 years ago
|
TQListViewItem* item = new TQListViewItem(
|
||
15 years ago
|
listItem, (*itList).addressee.formattedName() );
|
||
|
item->setEnabled( false );
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem::KWMailMergeTDEABCConfigListItem( TQListView *parent,
|
||
12 years ago
|
const TDEABC::Addressee& addressEntry ) : TQListViewItem( parent )
|
||
15 years ago
|
{
|
||
|
setText( 0, addressEntry.formattedName() );
|
||
|
_addressEntry = addressEntry;
|
||
|
}
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem::KWMailMergeTDEABCConfigListItem( TQListViewItem *parent,
|
||
12 years ago
|
const TDEABC::Addressee& addressEntry ) : TQListViewItem( parent )
|
||
15 years ago
|
{
|
||
|
setText( 0, addressEntry.formattedName() );
|
||
|
_addressEntry = addressEntry;
|
||
|
}
|
||
|
|
||
12 years ago
|
KWMailMergeTDEABCConfigListItem::~KWMailMergeTDEABCConfigListItem()
|
||
15 years ago
|
{}
|
||
|
|
||
12 years ago
|
TDEABC::Addressee KWMailMergeTDEABCConfigListItem::addressee() const
|
||
15 years ago
|
{
|
||
|
return _addressEntry;
|
||
|
}
|
||
|
|
||
12 years ago
|
TQString KWMailMergeTDEABCConfigListItem::text( int column ) const
|
||
15 years ago
|
{
|
||
|
if( column == -1 )
|
||
|
{
|
||
|
return _addressEntry.uid();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
14 years ago
|
return TQListViewItem::text( column );
|
||
15 years ago
|
}
|
||
|
}
|
||
|
|
||
12 years ago
|
#include "KWMailMergeTDEABCConfig.moc"
|