knewstuff.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
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 }
KDE Home | KDE Accessibility Home | Description of Access Keys