TDE core libraries
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.

knewstuff.cpp 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. This file is part of KOrganizer.
  3. Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library 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 GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include <tdeaction.h>
  18. #include <tdeapplication.h>
  19. #include <kdebug.h>
  20. #include <tdelocale.h>
  21. #include <kstandarddirs.h>
  22. #include "engine.h"
  23. #include "knewstuff.h"
  24. using namespace KNS;
  25. TDEAction* KNS::standardAction(const TQString& what,
  26. const TQObject *recvr,
  27. const char *slot, TDEActionCollection* parent,
  28. const char *name)
  29. {
  30. return new TDEAction(i18n("Download New %1").arg(what), "knewstuff",
  31. 0, recvr, slot, parent, name);
  32. }
  33. KNewStuff::KNewStuff( const TQString &type, TQWidget *parentWidget )
  34. {
  35. mEngine = new Engine( this, type, parentWidget );
  36. }
  37. KNewStuff::KNewStuff( const TQString &type, const TQString &providerList, TQWidget *parentWidget )
  38. {
  39. mEngine = new Engine( this, type, providerList, parentWidget );
  40. }
  41. TQString KNewStuff::type() const
  42. {
  43. return mEngine->type();
  44. }
  45. TQWidget *KNewStuff::parentWidget() const
  46. {
  47. return mEngine->parentWidget();
  48. }
  49. KNewStuff::~KNewStuff()
  50. {
  51. delete mEngine;
  52. }
  53. void KNewStuff::download()
  54. {
  55. mEngine->download();
  56. }
  57. TQString KNewStuff::downloadDestination( Entry * )
  58. {
  59. return TDEGlobal::dirs()->saveLocation( "tmp" ) +
  60. TDEApplication::randomString( 10 );
  61. }
  62. void KNewStuff::upload()
  63. {
  64. mEngine->upload();
  65. }
  66. void KNewStuff::upload( const TQString &fileName, const TQString previewName )
  67. {
  68. mEngine->upload(fileName, previewName);
  69. }