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.

205 lines
5.3KB

  1. /*
  2. This file is part of KAddressbook.
  3. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. As a special exception, permission is given to link this program
  16. with any edition of TQt, and distribute the resulting executable,
  17. without including the source code for TQt in the source distribution.
  18. */
  19. #ifndef KAB_CORE_H
  20. #define KAB_CORE_H
  21. #include <config.h> // for KDEPIM_NEW_DISTRLISTS
  22. #ifdef KDEPIM_NEW_DISTRLISTS
  23. #include <libtdepim/distributionlist.h>
  24. #endif
  25. #include <tqobject.h>
  26. #include <kabc/field.h>
  27. #include <kcommand.h>
  28. #include <kxmlguiclient.h>
  29. #include <kdepimmacros.h>
  30. namespace KABC {
  31. class AddressBook;
  32. class Resource;
  33. }
  34. class TQWidget;
  35. class KActionCollection;
  36. class KConfig;
  37. class KURL;
  38. namespace KAB {
  39. class SearchManager;
  40. class KDE_EXPORT Core : public TQObject
  41. {
  42. Q_OBJECT
  43. TQ_OBJECT
  44. public:
  45. Core( KXMLGUIClient *client, TQObject *parent, const char *name = 0 );
  46. /**
  47. Returns a pointer to the StdAddressBook of the application.
  48. */
  49. virtual KABC::AddressBook *addressBook() const = 0;
  50. /**
  51. Returns a pointer to the KConfig object of the application.
  52. */
  53. virtual KConfig *config() const = 0;
  54. /**
  55. Returns a pointer to the global KActionCollection object. So
  56. other classes can register their actions easily.
  57. */
  58. virtual KActionCollection *actionCollection() const = 0;
  59. /**
  60. Returns a pointer to the gui client.
  61. */
  62. virtual KXMLGUIClient *guiClient() const { return mGUIClient; }
  63. /**
  64. Returns the current sort field.
  65. */
  66. virtual KABC::Field *currentSortField() const = 0;
  67. /**
  68. Returns the uid list of the currently selected contacts.
  69. */
  70. virtual TQStringList selectedUIDs() const = 0;
  71. /**
  72. Displays a ResourceSelectDialog and returns the selected
  73. resource or a null pointer if no resource was selected by
  74. the user.
  75. */
  76. virtual KABC::Resource *requestResource( TQWidget *parent ) = 0;
  77. /**
  78. Returns the parent widget.
  79. */
  80. virtual TQWidget *widget() const = 0;
  81. /**
  82. Deletes given contacts from the address book.
  83. @param uids The uids of the contacts, which shall be deleted.
  84. */
  85. virtual void deleteContacts( const TQStringList &uids ) = 0;
  86. /**
  87. Deletes given contacts from the address book.
  88. @param uids The uids of the contacts, which shall be deleted.
  89. */
  90. virtual void deleteDistributionLists( const TQStringList &uids ) = 0;
  91. #ifdef KDEPIM_NEW_DISTRLISTS
  92. /**
  93. Returns all the distribution lists.
  94. */
  95. virtual KPIM::DistributionList::List distributionLists() const = 0;
  96. /**
  97. Returns the name of all the distribution lists.
  98. */
  99. virtual TQStringList distributionListNames() const = 0;
  100. /**
  101. sets the distribution list to display. If null, the regular
  102. address book is to be displayed.
  103. */
  104. virtual void setSelectedDistributionList( const TQString &name ) = 0;
  105. #endif
  106. //// This class isn't part of interfaces/, so this method here isn't really useful
  107. virtual SearchManager *searchManager() const = 0;
  108. virtual KCommandHistory *commandHistory() const = 0;
  109. signals:
  110. /**
  111. Forwarded from SearchManager
  112. After it is emitted, distributionListNames() might have a different result.
  113. */
  114. void contactsUpdated();
  115. public slots:
  116. /**
  117. Is called whenever a contact is selected in the view.
  118. */
  119. virtual void setContactSelected( const TQString &uid ) = 0;
  120. /**
  121. DCOP METHOD: Adds the given email address to address book.
  122. */
  123. virtual void addEmail( const TQString& addr ) = 0;
  124. /**
  125. DCOP METHOD: Imports the vCard, located at the given url.
  126. */
  127. virtual void importVCard( const KURL& url ) = 0;
  128. /**
  129. DCOP METHOD: Imports the given vCard.
  130. */
  131. virtual void importVCardFromData( const TQString& vCard ) = 0;
  132. /**
  133. DCOP METHOD: Opens contact editor to input a new contact.
  134. */
  135. virtual void newContact() = 0;
  136. /**
  137. DCOP METHOD: Opens distribution list editor to input a new distribution list.
  138. */
  139. virtual void newDistributionList() = 0;
  140. /**
  141. DCOP METHOD: Returns the name of the contact, that matches the given
  142. phone number.
  143. */
  144. virtual TQString getNameByPhone( const TQString& phone ) = 0;
  145. /**
  146. Shows an edit dialog for the given uid.
  147. */
  148. virtual void editContact( const TQString &uid = TQString() ) = 0;
  149. /**
  150. Shows an edit dialog for the given distribution list
  151. */
  152. virtual void editDistributionList( const TQString &name ) = 0;
  153. private:
  154. KXMLGUIClient *mGUIClient;
  155. };
  156. }
  157. #endif