TDE network 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.

query.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* $Id$ */
  2. #ifndef _QUERY_SERVICE
  3. #define _QUERY_SERVICE
  4. /***************************************************************************
  5. query.h - A query interface to select RSS feeds.
  6. -------------------
  7. begin : Saturday 15 February 2003
  8. copyright : (C) 2003 by Ian Reinhart Geiser
  9. email : geiseri@kde.org
  10. ***************************************************************************/
  11. /***************************************************************************
  12. * *
  13. * This program is free software; you can redistribute it and/or modify *
  14. * it under the terms of the GNU General Public License as published by *
  15. * the Free Software Foundation; either version 2 of the License, or *
  16. * (at your option) any later version. *
  17. * *
  18. ***************************************************************************/
  19. #include "rssnewsfeed.h"
  20. #include "xmlrpciface.h"
  21. #include <dcopobject.h>
  22. #include <tqmap.h>
  23. #include <tqobject.h>
  24. #include <tqvaluelist.h>
  25. #include <tqvariant.h>
  26. class RSSService;
  27. /**
  28. * Helper class which just calls the slot given it's TQObject/const char*
  29. * representation.
  30. */
  31. class SlotCaller : public TQObject
  32. {
  33. Q_OBJECT
  34. //
  35. public:
  36. static void call( TQObject *object, const char *slot,
  37. const KXMLRPC::Query::Result &value );
  38. signals:
  39. void signal( const KXMLRPC::Query::Result &value );
  40. private:
  41. SlotCaller() { }
  42. };
  43. class QueryService : public TQObject, public DCOPObject
  44. {
  45. K_DCOP
  46. Q_OBJECT
  47. //
  48. public:
  49. QueryService( RSSService *service );
  50. k_dcop_signals:
  51. void feedIds( TQValueList<int> ids );
  52. void feedInfo(TQMap<TQString, TQString> links);
  53. void feedInfo(TQValueList<RSSNewsFeed> feeds);
  54. void gotCategories( const TQStringList &categories );
  55. void gotFeedsInCategory( const TQValueList<int> &ids );
  56. k_dcop:
  57. /**
  58. * Lists the active feeds in use...
  59. **/
  60. TQStringList listActive(); // just for testing...
  61. /**
  62. * Query the www.syndic8.com XML-RPC interface for the
  63. * string. The RSS ids are treturned in a integer list.
  64. **/
  65. void findFeeds( const TQString& query );
  66. /**
  67. * Query the www.syndic8.com XML-RPC interface for the
  68. * string and matches it against the SiteURL feed of
  69. * each feed in the feed list. The RSS ids are treturned
  70. * in a integer list.
  71. **/
  72. void findSites( const TQString& query );
  73. /**
  74. * Query the www.syndic8.com XML-RPC interface for the
  75. * requested RSS feed(s). Returned is a TQMap with the format
  76. * of Name (Site URL), RSS URL
  77. **/
  78. void getFeedInfo( const TQVariant& ids );
  79. /**
  80. * Returns the list of subcategories in the specified category.
  81. * If no "Top" is specified, the root categories are returned.
  82. */
  83. void getCategories( const TQString &category );
  84. /**
  85. * Queries the database for the list of needsfeed ID's which are
  86. * associated with the given category.
  87. */
  88. void getFeedsInCategory( const TQString &category );
  89. private slots:
  90. void slotFoundFeeds( const KXMLRPC::Query::Result &result );
  91. void slotGotFeedInfo( const KXMLRPC::Query::Result &result );
  92. void slotGotCategories( const KXMLRPC::Query::Result &result );
  93. void slotGotFeedsInCategory( const KXMLRPC::Query::Result &result );
  94. private:
  95. void cachedCall( const TQString &method, const TQValueList<TQVariant> &args,
  96. const char *slot );
  97. void updateCache( const KXMLRPC::Query::Result &result );
  98. RSSService *m_service;
  99. KXMLRPC::Server *m_xmlrpcServer;
  100. };
  101. #endif