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.
224 lines
7.1 KiB
224 lines
7.1 KiB
15 years ago
|
/* -*- mode: C++; c-file-style: "gnu" -*-
|
||
|
*
|
||
13 years ago
|
* This file is part of libtdepim.
|
||
15 years ago
|
*
|
||
|
* Copyright (c) 2003 Zack Rusin <zack@kde.org>
|
||
|
* Copyright (c) 2003 Aaron J. Seigo <aseigo@kde.org>
|
||
|
*
|
||
|
* 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.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef ADDRESSESDIALOG_H
|
||
|
#define ADDRESSESDIALOG_H
|
||
|
|
||
|
#include <kabc/addressee.h>
|
||
|
#include <kdialogbase.h>
|
||
|
#include <klistview.h>
|
||
15 years ago
|
#include <tqstringlist.h>
|
||
|
#include <tqptrlist.h>
|
||
|
#include <tqptrdict.h>
|
||
13 years ago
|
#include <tdepimmacros.h>
|
||
15 years ago
|
|
||
|
namespace KPIM {
|
||
|
|
||
15 years ago
|
class AddresseeViewItem : public TQObject, public KListViewItem
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
|
||
|
public:
|
||
|
enum Category {
|
||
|
To =0,
|
||
|
CC =1,
|
||
|
BCC =2,
|
||
|
Group =3,
|
||
|
Entry =4,
|
||
|
FilledGroup =5,
|
||
|
DistList =6
|
||
|
};
|
||
14 years ago
|
AddresseeViewItem( AddresseeViewItem *parent, const KABC::Addressee& addr, int emailIndex = 0 );
|
||
15 years ago
|
AddresseeViewItem( KListView *lv, const TQString& name, Category cat=Group );
|
||
14 years ago
|
AddresseeViewItem( AddresseeViewItem *parent, const TQString& name, const KABC::Addressee::List &lst );
|
||
|
AddresseeViewItem( AddresseeViewItem *parent, const TQString& name );
|
||
15 years ago
|
~AddresseeViewItem();
|
||
|
|
||
|
KABC::Addressee addressee() const;
|
||
|
KABC::Addressee::List addresses() const;
|
||
|
Category category() const;
|
||
|
|
||
15 years ago
|
TQString name() const;
|
||
|
TQString email() const;
|
||
15 years ago
|
|
||
15 years ago
|
bool matches( const TQString& ) const;
|
||
15 years ago
|
|
||
15 years ago
|
virtual int compare( TQListViewItem * i, int col, bool ascending ) const;
|
||
15 years ago
|
virtual void setSelected( bool );
|
||
|
|
||
|
signals:
|
||
|
void addressSelected( AddresseeViewItem*, bool );
|
||
|
|
||
|
private:
|
||
|
struct AddresseeViewItemPrivate;
|
||
|
AddresseeViewItemPrivate *d;
|
||
|
};
|
||
|
|
||
|
class KDE_EXPORT AddressesDialog : public KDialogBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
AddressesDialog( TQWidget *widget=0, const char *name=0 );
|
||
15 years ago
|
~AddressesDialog();
|
||
|
|
||
|
/**
|
||
15 years ago
|
* Returns the list of picked "To" addresses as a TQStringList.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQStringList to() const;
|
||
15 years ago
|
/**
|
||
15 years ago
|
* Returns the list of picked "CC" addresses as a TQStringList.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQStringList cc() const;
|
||
15 years ago
|
/**
|
||
15 years ago
|
* Returns the list of picked "BCC" addresses as a TQStringList.
|
||
15 years ago
|
*/
|
||
15 years ago
|
TQStringList bcc() const;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns the list of picked "To" addresses as KABC::Addressee::List.
|
||
|
* Note that this doesn't include the distribution lists
|
||
|
*/
|
||
|
KABC::Addressee::List toAddresses() const;
|
||
|
/**
|
||
|
* Returns the list of picked "To" addresses as KABC::Addressee::List.
|
||
|
* Note that this does include the distribution lists
|
||
|
* Multiple Addressees are removed
|
||
|
*/
|
||
|
KABC::Addressee::List allToAddressesNoDuplicates() const;
|
||
|
/**
|
||
|
* Returns the list of picked "CC" addresses as KABC::Addressee::List.
|
||
|
* Note that this doesn't include the distribution lists
|
||
|
*/
|
||
|
KABC::Addressee::List ccAddresses() const;
|
||
|
/**
|
||
|
* Returns the list of picked "BCC" addresses as KABC::Addressee::List.
|
||
|
* Note that this doesn't include the distribution lists
|
||
|
*/
|
||
|
KABC::Addressee::List bccAddresses() const;
|
||
|
|
||
|
/**
|
||
|
* Returns the list of picked "To" distribution lists.
|
||
|
* This complements @ref toAddresses.
|
||
|
*/
|
||
15 years ago
|
TQStringList toDistributionLists() const;
|
||
15 years ago
|
/**
|
||
|
* Returns the list of picked "CC" distribution lists.
|
||
|
* This complements @ref ccAddresses.
|
||
|
*/
|
||
15 years ago
|
TQStringList ccDistributionLists() const;
|
||
15 years ago
|
/**
|
||
|
* Returns the list of picked "BCC" distribution lists.
|
||
|
* This complements @ref bccAddresses.
|
||
|
*/
|
||
15 years ago
|
TQStringList bccDistributionLists() const;
|
||
15 years ago
|
|
||
|
public slots:
|
||
|
/**
|
||
|
* Displays the CC field if @p b is true, else
|
||
|
* hides it. By default displays it.
|
||
|
*/
|
||
|
void setShowCC( bool b );
|
||
|
/**
|
||
|
* Displays the BCC field if @p b is true, else
|
||
|
* hides it. By default displays it.
|
||
|
*/
|
||
|
void setShowBCC( bool b );
|
||
|
/**
|
||
|
* If called adds "Recent Addresses" item to the picker list view,
|
||
|
* with the addresses given in @p addr.
|
||
|
*/
|
||
|
void setRecentAddresses( const KABC::Addressee::List& addr );
|
||
|
/**
|
||
|
* Adds addresses in @p l to the selected "To" group.
|
||
|
*/
|
||
15 years ago
|
void setSelectedTo( const TQStringList& l );
|
||
15 years ago
|
/**
|
||
|
* Adds addresses in @p l to the selected "CC" group.
|
||
|
*/
|
||
15 years ago
|
void setSelectedCC( const TQStringList& l );
|
||
15 years ago
|
/**
|
||
|
* Adds addresses in @p l to the selected "BCC" group.
|
||
|
*/
|
||
15 years ago
|
void setSelectedBCC( const TQStringList& l );
|
||
15 years ago
|
|
||
|
protected slots:
|
||
|
void addSelectedTo();
|
||
|
void addSelectedCC();
|
||
|
void addSelectedBCC();
|
||
|
|
||
|
void removeEntry();
|
||
|
void saveAs();
|
||
|
void searchLdap();
|
||
|
void ldapSearchResult();
|
||
|
void launchAddressBook();
|
||
|
|
||
15 years ago
|
void filterChanged( const TQString & );
|
||
15 years ago
|
|
||
|
void updateAvailableAddressees();
|
||
|
void availableSelectionChanged();
|
||
|
void selectedSelectionChanged();
|
||
|
void availableAddressSelected( AddresseeViewItem* item, bool selected );
|
||
|
void selectedAddressSelected( AddresseeViewItem* item, bool selected );
|
||
|
|
||
|
protected:
|
||
|
AddresseeViewItem* selectedToItem();
|
||
|
AddresseeViewItem* selectedCcItem();
|
||
|
AddresseeViewItem* selectedBccItem();
|
||
|
|
||
|
void initConnections();
|
||
|
void addDistributionLists();
|
||
|
void addAddresseeToAvailable( const KABC::Addressee& addr,
|
||
|
AddresseeViewItem* defaultParent=0, bool useCategory=true );
|
||
|
void addAddresseeToSelected( const KABC::Addressee& addr,
|
||
|
AddresseeViewItem* defaultParent=0 );
|
||
14 years ago
|
void addAddresseesToSelected( AddresseeViewItem *parent,
|
||
15 years ago
|
const TQPtrList<AddresseeViewItem>& addresses );
|
||
|
TQStringList entryToString( const KABC::Addressee::List& l ) const;
|
||
14 years ago
|
KABC::Addressee::List allAddressee( AddresseeViewItem* parent ) const;
|
||
15 years ago
|
KABC::Addressee::List allAddressee( KListView* view, bool onlySelected = true ) const;
|
||
14 years ago
|
TQStringList allDistributionLists( AddresseeViewItem* parent ) const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
// if there's only one group in the available list, open it
|
||
|
void checkForSingleAvailableGroup();
|
||
|
|
||
|
// used to re-show items in the available list
|
||
|
// it is recursive, but should only ever recurse once so should be fine
|
||
|
void unmapSelectedAddress(AddresseeViewItem* item);
|
||
|
void updateRecentAddresses();
|
||
|
|
||
|
struct AddressesDialogPrivate;
|
||
|
AddressesDialogPrivate *d;
|
||
|
|
||
15 years ago
|
TQPtrList<AddresseeViewItem> selectedAvailableAddresses;
|
||
|
TQPtrList<AddresseeViewItem> selectedSelectedAddresses;
|
||
|
TQPtrDict<AddresseeViewItem> selectedToAvailableMapping;
|
||
15 years ago
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif /* ADDRESSESDIALOG_H */
|