• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdenewstuff
 

tdenewstuff

  • tdenewstuff
knewstuff.cpp
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include <tdeaction.h>
22#include <tdeapplication.h>
23#include <kdebug.h>
24#include <tdelocale.h>
25#include <tdestandarddirs.h>
26
27#include "engine.h"
28
29#include "knewstuff.h"
30
31using namespace KNS;
32
33TDEAction* KNS::standardAction(const TQString& what,
34 const TQObject *recvr,
35 const char *slot, TDEActionCollection* parent,
36 const char *name)
37{
38 return new TDEAction(i18n("Download New %1").arg(what), "knewstuff",
39 0, recvr, slot, parent, name);
40}
41
42TDENewStuff::TDENewStuff( const TQString &type, TQWidget *parentWidget )
43{
44 mEngine = new Engine( this, type, parentWidget );
45}
46
47TDENewStuff::TDENewStuff( const TQString &type, const TQString &providerList, TQWidget *parentWidget )
48{
49 mEngine = new Engine( this, type, providerList, parentWidget );
50}
51
52TQString TDENewStuff::type() const
53{
54 return mEngine->type();
55}
56
57TQWidget *TDENewStuff::parentWidget() const
58{
59 return mEngine->parentWidget();
60}
61
62TDENewStuff::~TDENewStuff()
63{
64 delete mEngine;
65}
66
67void TDENewStuff::download()
68{
69 mEngine->download();
70}
71
72TQString TDENewStuff::downloadDestination( Entry *entry )
73{
74 // Respect downloaded file's extension
75 TQString ext = entry->payload().fileName().section('.', 1);
76 if ( ! ext.isEmpty() ) ext = "." + ext;
77
78 return TDEGlobal::dirs()->saveLocation( "tmp" ) +
79 TDEApplication::randomString( 10 ) + ext;
80}
81
82void TDENewStuff::upload()
83{
84 mEngine->upload();
85}
86
87void TDENewStuff::upload( const TQString &fileName, const TQString previewName )
88{
89 mEngine->upload(fileName, previewName);
90}
KNS::Engine
Central class combining all possible TDENewStuff operations.
Definition: engine.h:53
KNS::Engine::download
void download()
Initiates the download process, retrieving provider lists and invoking the download dialog.
Definition: engine.cpp:82
KNS::Engine::type
TQString type() const
Returns the previously set data type.
Definition: engine.h:85
KNS::Engine::parentWidget
TQWidget * parentWidget() const
Returns the previously set parent widget.
Definition: engine.h:92
KNS::Engine::upload
void upload(const TQString &fileName=TQString::null, const TQString &previewName=TQString::null)
Initiates the upload process, invoking the provider selection dialog and the file upload dialog.
Definition: engine.cpp:245
KNS::Entry
TDENewStuff data entry container.
Definition: entry.h:46
KNS::Entry::payload
KURL payload(const TQString &lang=TQString::null) const
Retrieve the file name of the object.
Definition: entry.cpp:228
TDENewStuff::downloadDestination
virtual TQString downloadDestination(KNS::Entry *entry)
Return a filename which should be used as destination for downloading the specified new stuff entry.
Definition: knewstuff.cpp:72
TDENewStuff::type
TQString type() const
Return type of data.
Definition: knewstuff.cpp:52
TDENewStuff::parentWidget
TQWidget * parentWidget() const
Return parent widget.
Definition: knewstuff.cpp:57
TDENewStuff::upload
void upload()
Start upload process.
Definition: knewstuff.cpp:82
TDENewStuff::TDENewStuff
TDENewStuff(const TQString &type, TQWidget *parentWidget=0)
Constructor.
Definition: knewstuff.cpp:42
TDENewStuff::download
void download()
Start download process.
Definition: knewstuff.cpp:67
KNS
Handles security releated issues, like signing, verifying.
Definition: downloaddialog.h:37

tdenewstuff

Skip menu "tdenewstuff"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdenewstuff

Skip menu "tdenewstuff"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdenewstuff by doxygen 1.9.4
This website is maintained by Timothy Pearson.