• 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 <kstandarddirs.h>
26 
27 #include "engine.h"
28 
29 #include "knewstuff.h"
30 
31 using namespace KNS;
32 
33 TDEAction* 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 
42 TDENewStuff::TDENewStuff( const TQString &type, TQWidget *parentWidget )
43 {
44  mEngine = new Engine( this, type, parentWidget );
45 }
46 
47 TDENewStuff::TDENewStuff( const TQString &type, const TQString &providerList, TQWidget *parentWidget )
48 {
49  mEngine = new Engine( this, type, providerList, parentWidget );
50 }
51 
52 TQString TDENewStuff::type() const
53 {
54  return mEngine->type();
55 }
56 
57 TQWidget *TDENewStuff::parentWidget() const
58 {
59  return mEngine->parentWidget();
60 }
61 
62 TDENewStuff::~TDENewStuff()
63 {
64  delete mEngine;
65 }
66 
67 void TDENewStuff::download()
68 {
69  mEngine->download();
70 }
71 
72 TQString 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 
82 void TDENewStuff::upload()
83 {
84  mEngine->upload();
85 }
86 
87 void TDENewStuff::upload( const TQString &fileName, const TQString previewName )
88 {
89  mEngine->upload(fileName, previewName);
90 }
TDENewStuff::TDENewStuff
TDENewStuff(const TQString &type, TQWidget *parentWidget=0)
Constructor.
Definition: knewstuff.cpp:42
TDENewStuff::parentWidget
TQWidget * parentWidget() const
Return parent widget.
Definition: knewstuff.cpp:57
KNS::Entry
TDENewStuff data entry container.
Definition: entry.h:45
KNS::Entry::payload
KURL payload(const TQString &lang=TQString::null) const
Retrieve the file name of the object.
Definition: entry.cpp:228
KNS
Handles security releated issues, like signing, verifying.
Definition: downloaddialog.h:36
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::download
void download()
Start download process.
Definition: knewstuff.cpp:67
TDENewStuff::upload
void upload()
Start upload process.
Definition: knewstuff.cpp:82
KNS::Engine
Central class combining all possible TDENewStuff operations.
Definition: engine.h:52
TDENewStuff::type
TQString type() const
Return type of data.
Definition: knewstuff.cpp:52

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdenewstuff by doxygen 1.8.8
This website is maintained by Timothy Pearson.