TDE graphics utilities
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.

85 lines
2.3KB

  1. /* This file is part of the KDE project
  2. Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public
  5. License as published by the Free Software Foundation, version 2.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; see the file COPYING. If not, write to
  12. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  13. Boston, MA 02110-1301, USA.
  14. */
  15. #ifndef MRML_H
  16. #define MRML_H
  17. #include <tdeio/tcpslavebase.h>
  18. #include <kurl.h>
  19. #include <kmrml_config.h>
  20. #include "mrml_shared.h"
  21. class Mrml : public TDEIO::TCPSlaveBase
  22. {
  23. public:
  24. Mrml( const TQCString&, const TQCString& );
  25. ~Mrml();
  26. virtual void get( const KURL& url );
  27. virtual void mimetype( const KURL& url );
  28. private:
  29. TQCString readAll();
  30. void emitData( const TQCString& );
  31. bool startSession( const KURL& url );
  32. // helpers
  33. inline TQString sessionId() {
  34. return metaData( MrmlShared::sessionId() );
  35. }
  36. // misc
  37. short int port( const KURL& url )
  38. {
  39. return (url.port() != 0) ?
  40. url.port() :
  41. m_config.settingsForHost( url.host() ).port();
  42. }
  43. static TQString mrmlString( const TQString& sessionId,
  44. const TQString& transactionId = TQString() );
  45. static TQCString loginString();
  46. static TQCString getConfigurationString();
  47. static TQCString getSessionsString( const TQString& username,
  48. const TQString& password );
  49. TQString user( const KURL& url ) {
  50. return url.hasUser() ?
  51. url.user() : m_config.defaultSettings().user;
  52. }
  53. TQString pass( const KURL& url ) {
  54. return url.hasPass() ?
  55. url.pass() : m_config.defaultSettings().pass;
  56. }
  57. bool checkLocalServer( const KURL& url );
  58. static const int bufsize;
  59. TQString defaultUser;
  60. TQString defaultPass;
  61. KMrml::Config m_config;
  62. };
  63. #endif // MRML_H