home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / knewstuff / knewstuffgeneric.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.6 KB  |  87 lines

  1. /*
  2.     This file is part of KDE.
  3.  
  4.     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef KNEWSTUFFGENERIC_H
  22. #define KNEWSTUFFGENERIC_H
  23.  
  24. #include "knewstuff.h"
  25.  
  26. class KConfig;
  27.  
  28. /**
  29.  * @short Basic KNewStuff class with predefined actions.
  30.  *
  31.  * This class is used for data uploads and installation.
  32.  * \code
  33.  * QString payload, preview;
  34.  * KNewStuffGeneric *ns = new KNewStuffGeneric("kamikaze/level", this);
  35.  * ns->upload(payload, preview);
  36.  * \endcode
  37.  *
  38.  * @author Cornelius Schumacher (schumacher@kde.org)
  39.  * \par Maintainer:
  40.  * Josef Spillner (spillner@kde.org)
  41.  */
  42. class KDE_EXPORT KNewStuffGeneric : public KNewStuff
  43. {
  44.   public:
  45.     /**
  46.       Constructor.
  47.  
  48.       @param type a Hotstuff data type such as "korganizer/calendar"
  49.       @param parent the parent window.
  50.     */
  51.     KNewStuffGeneric( const QString &type, QWidget *parent = 0 );
  52.     ~KNewStuffGeneric();
  53.  
  54.     /**
  55.       Installs a downloaded file according to the application's configuration.
  56.  
  57.       @param fileName filename of the donwloaded file
  58.       @return @c true in case of installation success, @c false otherwise
  59.     */
  60.     bool install( const QString &fileName );
  61.  
  62.     /**
  63.       Creates a file suitable for upload.
  64.       Note that this method always fails, since using KNewStuffGeneric
  65.       means that the provided file must already be in a usable format.
  66.  
  67.       @param fileName the name of the file to upload after its creation
  68.       @return @c true in case of creation success, @c false otherwise
  69.     */
  70.     bool createUploadFile( const QString &fileName );
  71.  
  72.     /**
  73.       Queries the preferred destination file for a download.
  74.  
  75.       @param entry a Hotstuff data entry
  76.       @return destination filename, or 0 to return directory only
  77.     */
  78.     QString downloadDestination( KNS::Entry *entry );
  79.  
  80.   private:
  81.     QString destinationPath( KNS::Entry *entry );
  82.  
  83.     KConfig *mConfig;
  84. };
  85.  
  86. #endif
  87.