summaryrefslogtreecommitdiffstats
path: root/kaddressbook/ldapsearchdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kaddressbook/ldapsearchdialog.cpp')
-rw-r--r--kaddressbook/ldapsearchdialog.cpp170
1 files changed, 85 insertions, 85 deletions
diff --git a/kaddressbook/ldapsearchdialog.cpp b/kaddressbook/ldapsearchdialog.cpp
index 706b982ff..fc99562d4 100644
--- a/kaddressbook/ldapsearchdialog.cpp
+++ b/kaddressbook/ldapsearchdialog.cpp
@@ -20,14 +20,14 @@
#include "config.h"
-#include <qcheckbox.h>
-#include <qgroupbox.h>
-#include <qheader.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlistview.h>
-#include <qmap.h>
-#include <qpushbutton.h>
+#include <tqcheckbox.h>
+#include <tqgroupbox.h>
+#include <tqheader.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlistview.h>
+#include <tqmap.h>
+#include <tqpushbutton.h>
#include <addresseelineedit.h>
#include <kapplication.h>
@@ -46,23 +46,23 @@
#include "distributionlistpicker.h"
#endif
-static QString asUtf8( const QByteArray &val )
+static TQString asUtf8( const TQByteArray &val )
{
if ( val.isEmpty() )
- return QString::null;
+ return TQString::null;
const char *data = val.data();
- //QString::fromUtf8() bug workaround
+ //TQString::fromUtf8() bug workaround
if ( data[ val.size() - 1 ] == '\0' )
- return QString::fromUtf8( data, val.size() - 1 );
+ return TQString::fromUtf8( data, val.size() - 1 );
else
- return QString::fromUtf8( data, val.size() );
+ return TQString::fromUtf8( data, val.size() );
}
-static QString join( const KPIM::LdapAttrValue& lst, const QString& sep )
+static TQString join( const KPIM::LdapAttrValue& lst, const TQString& sep )
{
- QString res;
+ TQString res;
bool alredy = false;
for ( KPIM::LdapAttrValue::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
if ( alredy )
@@ -73,9 +73,9 @@ static QString join( const KPIM::LdapAttrValue& lst, const QString& sep )
return res;
}
-static QMap<QString, QString>& adrbookattr2ldap()
+static TQMap<TQString, TQString>& adrbookattr2ldap()
{
- static QMap<QString, QString> keys;
+ static TQMap<TQString, TQString> keys;
if ( keys.isEmpty() ) {
keys[ i18n( "Title" ) ] = "title";
@@ -104,17 +104,17 @@ static QMap<QString, QString>& adrbookattr2ldap()
class ContactListItem : public QListViewItem
{
public:
- ContactListItem( QListView* parent, const KPIM::LdapAttrMap& attrs )
- : QListViewItem( parent ), mAttrs( attrs )
+ ContactListItem( TQListView* parent, const KPIM::LdapAttrMap& attrs )
+ : TQListViewItem( parent ), mAttrs( attrs )
{ }
KPIM::LdapAttrMap mAttrs;
- virtual QString text( int col ) const
+ virtual TQString text( int col ) const
{
// Look up a suitable attribute for column col
- const QString colName = listView()->columnText( col );
- const QString ldapAttrName = adrbookattr2ldap()[ colName ];
+ const TQString colName = listView()->columnText( col );
+ const TQString ldapAttrName = adrbookattr2ldap()[ colName ];
return join( mAttrs[ ldapAttrName ], ", " );
}
};
@@ -122,13 +122,13 @@ class ContactListItem : public QListViewItem
class LDAPSearchDialog::Private
{
public:
- static QValueList<ContactListItem*> selectedItems( QListView* );
- QMap<const ContactListItem*, QString> itemToServer;
+ static TQValueList<ContactListItem*> selectedItems( TQListView* );
+ TQMap<const ContactListItem*, TQString> itemToServer;
};
-QValueList<ContactListItem*> LDAPSearchDialog::Private::selectedItems( QListView* view )
+TQValueList<ContactListItem*> LDAPSearchDialog::Private::selectedItems( TQListView* view )
{
- QValueList<ContactListItem*> selected;
+ TQValueList<ContactListItem*> selected;
ContactListItem* cli = static_cast<ContactListItem*>( view->firstChild() );
while ( cli ) {
if ( cli->isSelected() )
@@ -139,32 +139,32 @@ QValueList<ContactListItem*> LDAPSearchDialog::Private::selectedItems( QListView
}
LDAPSearchDialog::LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core,
- QWidget* parent, const char* name )
+ TQWidget* parent, const char* name )
: KDialogBase( Plain, i18n( "Search for Addresses in Directory" ), Help | User1 | User2 |
Cancel, Default, parent, name, false, true ),
mAddressBook( ab ), mCore( core ), d( new Private )
{
setButtonCancel( KStdGuiItem::close() );
- QFrame *page = plainPage();
- QVBoxLayout *topLayout = new QVBoxLayout( page, marginHint(), spacingHint() );
+ TQFrame *page = plainPage();
+ TQVBoxLayout *topLayout = new TQVBoxLayout( page, marginHint(), spacingHint() );
- QGroupBox *groupBox = new QGroupBox( i18n( "Search for Addresses in Directory" ),
+ TQGroupBox *groupBox = new TQGroupBox( i18n( "Search for Addresses in Directory" ),
page );
- groupBox->setFrameShape( QGroupBox::Box );
- groupBox->setFrameShadow( QGroupBox::Sunken );
+ groupBox->setFrameShape( TQGroupBox::Box );
+ groupBox->setFrameShadow( TQGroupBox::Sunken );
groupBox->setColumnLayout( 0, Qt::Vertical );
- QGridLayout *boxLayout = new QGridLayout( groupBox->layout(), 2,
+ TQGridLayout *boxLayout = new TQGridLayout( groupBox->layout(), 2,
5, spacingHint() );
boxLayout->setColStretch( 1, 1 );
- QLabel *label = new QLabel( i18n( "Search for:" ), groupBox );
+ TQLabel *label = new TQLabel( i18n( "Search for:" ), groupBox );
boxLayout->addWidget( label, 0, 0 );
mSearchEdit = new KLineEdit( groupBox );
boxLayout->addWidget( mSearchEdit, 0, 1 );
label->setBuddy( mSearchEdit );
- label = new QLabel( i18n( "In LDAP attribute", "in" ), groupBox );
+ label = new TQLabel( i18n( "In LDAP attribute", "in" ), groupBox );
boxLayout->addWidget( label, 0, 2 );
mFilterCombo = new KComboBox( groupBox );
@@ -174,8 +174,8 @@ LDAPSearchDialog::LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core,
mFilterCombo->insertItem( i18n( "Work Number" ) );
boxLayout->addWidget( mFilterCombo, 0, 3 );
- QSize buttonSize;
- mSearchButton = new QPushButton( i18n( "Stop" ), groupBox );
+ TQSize buttonSize;
+ mSearchButton = new TQPushButton( i18n( "Stop" ), groupBox );
buttonSize = mSearchButton->sizeHint();
mSearchButton->setText( i18n( "&Search" ) );
if ( buttonSize.width() < mSearchButton->sizeHint().width() )
@@ -185,7 +185,7 @@ LDAPSearchDialog::LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core,
mSearchButton->setDefault( true );
boxLayout->addWidget( mSearchButton, 0, 4 );
- mRecursiveCheckbox = new QCheckBox( i18n( "Recursive search" ), groupBox );
+ mRecursiveCheckbox = new TQCheckBox( i18n( "Recursive search" ), groupBox );
mRecursiveCheckbox->setChecked( true );
boxLayout->addMultiCellWidget( mRecursiveCheckbox, 1, 1, 0, 4 );
@@ -196,19 +196,19 @@ LDAPSearchDialog::LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core,
topLayout->addWidget( groupBox );
- mResultListView = new QListView( page );
- mResultListView->setSelectionMode( QListView::Multi );
+ mResultListView = new TQListView( page );
+ mResultListView->setSelectionMode( TQListView::Multi );
mResultListView->setAllColumnsShowFocus( true );
mResultListView->setShowSortIndicator( true );
topLayout->addWidget( mResultListView );
KButtonBox *buttons = new KButtonBox( page, Qt::Horizontal );
- buttons->addButton( i18n( "Select All" ), this, SLOT( slotSelectAll() ) );
- buttons->addButton( i18n( "Unselect All" ), this, SLOT( slotUnselectAll() ) );
+ buttons->addButton( i18n( "Select All" ), this, TQT_SLOT( slotSelectAll() ) );
+ buttons->addButton( i18n( "Unselect All" ), this, TQT_SLOT( slotUnselectAll() ) );
topLayout->addWidget( buttons );
- resize( QSize( 600, 400).expandedTo( minimumSizeHint() ) );
+ resize( TQSize( 600, 400).expandedTo( minimumSizeHint() ) );
setButtonText( User1, i18n( "Add Selected" ) );
@@ -222,10 +222,10 @@ LDAPSearchDialog::LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core,
mNumHosts = 0;
mIsOK = false;
- connect( mRecursiveCheckbox, SIGNAL( toggled( bool ) ),
- this, SLOT( slotSetScope( bool ) ) );
- connect( mSearchButton, SIGNAL( clicked() ),
- this, SLOT( slotStartSearch() ) );
+ connect( mRecursiveCheckbox, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SLOT( slotSetScope( bool ) ) );
+ connect( mSearchButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotStartSearch() ) );
setTabOrder(mSearchEdit, mFilterCombo);
setTabOrder(mFilterCombo, mSearchButton);
@@ -268,19 +268,19 @@ void LDAPSearchDialog::restoreSettings()
KPIM::LdapServer ldapServer;
KPIM::LdapSearch::readConfig( ldapServer, config, j, true );
ldapClient->setServer( ldapServer );
- QStringList attrs;
+ TQStringList attrs;
- for ( QMap<QString,QString>::ConstIterator it = adrbookattr2ldap().begin(); it != adrbookattr2ldap().end(); ++it )
+ for ( TQMap<TQString,TQString>::ConstIterator it = adrbookattr2ldap().begin(); it != adrbookattr2ldap().end(); ++it )
attrs << *it;
ldapClient->setAttrs( attrs );
- connect( ldapClient, SIGNAL( result( const KPIM::LdapObject& ) ),
- this, SLOT( slotAddResult( const KPIM::LdapObject& ) ) );
- connect( ldapClient, SIGNAL( done() ),
- this, SLOT( slotSearchDone() ) );
- connect( ldapClient, SIGNAL( error( const QString& ) ),
- this, SLOT( slotError( const QString& ) ) );
+ connect( ldapClient, TQT_SIGNAL( result( const KPIM::LdapObject& ) ),
+ this, TQT_SLOT( slotAddResult( const KPIM::LdapObject& ) ) );
+ connect( ldapClient, TQT_SIGNAL( done() ),
+ this, TQT_SLOT( slotSearchDone() ) );
+ connect( ldapClient, TQT_SIGNAL( error( const TQString& ) ),
+ this, TQT_SLOT( slotError( const TQString& ) ) );
mLdapClientList.append( ldapClient );
}
@@ -345,7 +345,7 @@ void LDAPSearchDialog::slotSetScope( bool rec )
}
}
-QString LDAPSearchDialog::makeFilter( const QString& query, const QString& attr,
+TQString LDAPSearchDialog::makeFilter( const TQString& query, const TQString& attr,
bool startsWith )
{
/* The reasoning behind this filter is:
@@ -354,7 +354,7 @@ QString LDAPSearchDialog::makeFilter( const QString& query, const QString& attr,
* This allows both resource accounts with an email address which are not a person and
* person entries without an email address to show up, while still not showing things
* like structural entries in the ldap tree. */
- QString result( "&(|(objectclass=person)(objectclass=groupofnames)(mail=*))(" );
+ TQString result( "&(|(objectclass=person)(objectclass=groupofnames)(mail=*))(" );
if( query.isEmpty() )
// Return a filter that matches everything
return result + "|(cn=*)(sn=*)" + ")";
@@ -372,7 +372,7 @@ QString LDAPSearchDialog::makeFilter( const QString& query, const QString& attr,
result = result.arg( "telephoneNumber" ).arg( query );
} else {
// Error?
- result = QString::null;
+ result = TQString::null;
return result;
}
}
@@ -384,17 +384,17 @@ void LDAPSearchDialog::slotStartSearch()
{
cancelQuery();
- QApplication::setOverrideCursor( Qt::waitCursor );
+ TQApplication::setOverrideCursor( Qt::waitCursor );
mSearchButton->setText( i18n( "Stop" ) );
- disconnect( mSearchButton, SIGNAL( clicked() ),
- this, SLOT( slotStartSearch() ) );
- connect( mSearchButton, SIGNAL( clicked() ),
- this, SLOT( slotStopSearch() ) );
+ disconnect( mSearchButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotStartSearch() ) );
+ connect( mSearchButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotStopSearch() ) );
bool startsWith = (mSearchType->currentItem() == 1);
- QString filter = makeFilter( mSearchEdit->text().stripWhiteSpace(), mFilterCombo->currentText(), startsWith );
+ TQString filter = makeFilter( mSearchEdit->text().stripWhiteSpace(), mFilterCombo->currentText(), startsWith );
// loop in the list and run the KPIM::LdapClients
mResultListView->clear();
@@ -419,22 +419,22 @@ void LDAPSearchDialog::slotSearchDone()
return;
}
- disconnect( mSearchButton, SIGNAL( clicked() ),
- this, SLOT( slotStopSearch() ) );
- connect( mSearchButton, SIGNAL( clicked() ),
- this, SLOT( slotStartSearch() ) );
+ disconnect( mSearchButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotStopSearch() ) );
+ connect( mSearchButton, TQT_SIGNAL( clicked() ),
+ this, TQT_SLOT( slotStartSearch() ) );
mSearchButton->setText( i18n( "&Search" ) );
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
}
-void LDAPSearchDialog::slotError( const QString& error )
+void LDAPSearchDialog::slotError( const TQString& error )
{
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
KMessageBox::error( this, error );
}
-void LDAPSearchDialog::closeEvent( QCloseEvent* e )
+void LDAPSearchDialog::closeEvent( TQCloseEvent* e )
{
slotStopSearch();
e->accept();
@@ -444,15 +444,15 @@ void LDAPSearchDialog::closeEvent( QCloseEvent* e )
* Returns a ", " separated list of email addresses that were
* checked by the user
*/
-QString LDAPSearchDialog::selectedEMails() const
+TQString LDAPSearchDialog::selectedEMails() const
{
- QStringList result;
+ TQStringList result;
ContactListItem* cli = static_cast<ContactListItem*>( mResultListView->firstChild() );
while ( cli ) {
if ( cli->isSelected() ) {
- QString email = asUtf8( cli->mAttrs[ "mail" ].first() ).stripWhiteSpace();
+ TQString email = asUtf8( cli->mAttrs[ "mail" ].first() ).stripWhiteSpace();
if ( !email.isEmpty() ) {
- QString name = asUtf8( cli->mAttrs[ "cn" ].first() ).stripWhiteSpace();
+ TQString name = asUtf8( cli->mAttrs[ "cn" ].first() ).stripWhiteSpace();
if ( name.isEmpty() ) {
result << email;
} else {
@@ -546,27 +546,27 @@ KABC::Addressee LDAPSearchDialog::convertLdapAttributesToAddressee( const KPIM::
#ifdef KDEPIM_NEW_DISTRLISTS
KPIM::DistributionList LDAPSearchDialog::selectDistributionList()
{
- QGuardedPtr<KPIM::DistributionListPickerDialog> picker = new KPIM::DistributionListPickerDialog( mCore->addressBook(), this );
+ TQGuardedPtr<KPIM::DistributionListPickerDialog> picker = new KPIM::DistributionListPickerDialog( mCore->addressBook(), this );
picker->setLabelText( i18n( "Select a distribution list to add the selected contacts to." ) );
picker->setCaption( i18n( "Select Distribution List" ) );
picker->exec();
const KPIM::DistributionList list = KPIM::DistributionList::findByName( mCore->addressBook(), picker
-? picker->selectedDistributionList() : QString() );
+? picker->selectedDistributionList() : TQString() );
delete picker;
return list;
}
#endif
-KABC::Addressee::List LDAPSearchDialog::importContactsUnlessTheyExist( const QValueList<ContactListItem*>& selectedItems,
+KABC::Addressee::List LDAPSearchDialog::importContactsUnlessTheyExist( const TQValueList<ContactListItem*>& selectedItems,
KABC::Resource * const resource )
{
- const QDateTime now = QDateTime::currentDateTime();
- QStringList importedAddrs;
+ const TQDateTime now = TQDateTime::currentDateTime();
+ TQStringList importedAddrs;
KABC::Addressee::List localAddrs;
KABLock::self( mCore->addressBook() )->lock( resource );
- for ( QValueList<ContactListItem*>::ConstIterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
+ for ( TQValueList<ContactListItem*>::ConstIterator it = selectedItems.begin(); it != selectedItems.end(); ++it ) {
const ContactListItem * const cli = *it;
KABC::Addressee addr = convertLdapAttributesToAddressee( cli->mAttrs );
const KABC::Addressee::List existing = mCore->addressBook()->findByEmail( addr.preferredEmail() );
@@ -598,7 +598,7 @@ void LDAPSearchDialog::slotUser2()
KABC::Resource *resource = mCore->requestResource( this );
if ( !resource ) return;
- const QValueList<ContactListItem*> selectedItems = d->selectedItems( mResultListView );
+ const TQValueList<ContactListItem*> selectedItems = d->selectedItems( mResultListView );
if ( selectedItems.isEmpty() ) {
KMessageBox::information( this, i18n( "Please select the contacts you want to add to the distribution list." ), i18n( "No Contacts Selected" ) );
return;
@@ -614,7 +614,7 @@ void LDAPSearchDialog::slotUser2()
return;
for ( KABC::Addressee::List::ConstIterator it = localAddrs.begin(); it != localAddrs.end(); ++it ) {
- dist.insertEntry( *it, QString() );
+ dist.insertEntry( *it, TQString() );
}
KABLock::self( mCore->addressBook() )->lock( resource );
mCore->addressBook()->insertAddressee( dist );
@@ -627,7 +627,7 @@ void LDAPSearchDialog::slotUser1()
{
KABC::Resource *resource = mCore->requestResource( this );
if ( !resource ) return;
- const QValueList<ContactListItem*> selectedItems = d->selectedItems( mResultListView );
+ const TQValueList<ContactListItem*> selectedItems = d->selectedItems( mResultListView );
importContactsUnlessTheyExist( selectedItems, resource );
}