TDE personal information management applications
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.

119 lines
3.1KB

  1. /* ldapsearchdialogimpl.h - LDAP access
  2. * Copyright (C) 2002 Klar�lvdalens Datakonsult AB
  3. *
  4. * Author: Steffen Hansen <hansen@kde.org>
  5. *
  6. * This file is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This file is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  19. */
  20. #ifndef LDAPSEARCHDIALOG_H
  21. #define LDAPSEARCHDIALOG_H
  22. #include "config.h"
  23. #include <tqptrlist.h>
  24. #include <kabc/addressbook.h>
  25. #include <ldapclient.h>
  26. #include <kdialogbase.h>
  27. #ifdef KDEPIM_NEW_DISTRLISTS
  28. #include <libtdepim/distributionlist.h>
  29. #endif
  30. class KAddressBookTableView;
  31. class KComboBox;
  32. class KLineEdit;
  33. class TQCheckBox;
  34. class TQListView;
  35. class TQPushButton;
  36. class KABCore;
  37. class ContactListItem;
  38. namespace KABC {
  39. class Resource;
  40. }
  41. class LDAPSearchDialog : public KDialogBase
  42. {
  43. Q_OBJECT
  44. TQ_OBJECT
  45. public:
  46. LDAPSearchDialog( KABC::AddressBook *ab, KABCore *core, TQWidget* parent, const char* name = 0 );
  47. ~LDAPSearchDialog();
  48. bool isOK() const { return mIsOK; }
  49. void restoreSettings();
  50. signals:
  51. void addresseesAdded();
  52. protected slots:
  53. void slotAddResult( const KPIM::LdapObject& obj );
  54. void slotSetScope( bool rec );
  55. void slotStartSearch();
  56. void slotStopSearch();
  57. void slotSearchDone();
  58. void slotError( const TQString& );
  59. virtual void slotHelp();
  60. virtual void slotUser1();
  61. virtual void slotUser2();
  62. void slotSelectAll();
  63. void slotUnselectAll();
  64. /**
  65. * Traverses the given items and adds them to the given resource,
  66. * unless they already exist. Returns the list of both the added
  67. * and the existing contacts.
  68. */
  69. KABC::Addressee::List importContactsUnlessTheyExist( const TQValueList<ContactListItem*>& items, KABC::Resource * const resource );
  70. protected:
  71. TQString selectedEMails() const;
  72. virtual void closeEvent( TQCloseEvent* );
  73. private:
  74. void saveSettings();
  75. static KABC::Addressee convertLdapAttributesToAddressee( const KPIM::LdapAttrMap& attrs );
  76. #ifdef KDEPIM_NEW_DISTRLISTS
  77. KPIM::DistributionList selectDistributionList();
  78. #endif
  79. TQString makeFilter( const TQString& query, const TQString& attr, bool startsWith );
  80. void cancelQuery();
  81. int mNumHosts;
  82. TQPtrList<KPIM::LdapClient> mLdapClientList;
  83. bool mIsOK;
  84. KABC::AddressBook *mAddressBook;
  85. KABCore *mCore;
  86. KComboBox* mFilterCombo;
  87. KComboBox* mSearchType;
  88. KLineEdit* mSearchEdit;
  89. TQCheckBox* mRecursiveCheckbox;
  90. TQListView* mResultListView;
  91. TQPushButton* mSearchButton;
  92. class Private;
  93. Private* const d;
  94. };
  95. #endif