00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <tdeaction.h>
00022 #include <tdeapplication.h>
00023 #include <kdebug.h>
00024 #include <tdelocale.h>
00025 #include <kstandarddirs.h>
00026
00027 #include "engine.h"
00028
00029 #include "knewstuff.h"
00030
00031 using namespace KNS;
00032
00033 TDEAction* KNS::standardAction(const TQString& what,
00034 const TQObject *recvr,
00035 const char *slot, TDEActionCollection* parent,
00036 const char *name)
00037 {
00038 return new TDEAction(i18n("Download New %1").arg(what), "knewstuff",
00039 0, recvr, slot, parent, name);
00040 }
00041
00042 TDENewStuff::TDENewStuff( const TQString &type, TQWidget *parentWidget )
00043 {
00044 mEngine = new Engine( this, type, parentWidget );
00045 }
00046
00047 TDENewStuff::TDENewStuff( const TQString &type, const TQString &providerList, TQWidget *parentWidget )
00048 {
00049 mEngine = new Engine( this, type, providerList, parentWidget );
00050 }
00051
00052 TQString TDENewStuff::type() const
00053 {
00054 return mEngine->type();
00055 }
00056
00057 TQWidget *TDENewStuff::parentWidget() const
00058 {
00059 return mEngine->parentWidget();
00060 }
00061
00062 TDENewStuff::~TDENewStuff()
00063 {
00064 delete mEngine;
00065 }
00066
00067 void TDENewStuff::download()
00068 {
00069 mEngine->download();
00070 }
00071
00072 TQString TDENewStuff::downloadDestination( Entry * )
00073 {
00074 return TDEGlobal::dirs()->saveLocation( "tmp" ) +
00075 TDEApplication::randomString( 10 );
00076 }
00077
00078 void TDENewStuff::upload()
00079 {
00080 mEngine->upload();
00081 }
00082
00083 void TDENewStuff::upload( const TQString &fileName, const TQString previewName )
00084 {
00085 mEngine->upload(fileName, previewName);
00086 }