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