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 / knewstuffbutton.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.5 KB  |  116 lines

  1. /*
  2.     Copyright (c) 2004 Aaron J. Seigo <aseigo@kde.org>
  3.  
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     License as published by the Free Software Foundation; either
  7.     version 2 of the License, or (at your option) any later version.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.     Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #ifndef _khotnewbutton_h
  21. #define _khotnewbutton_h
  22.  
  23. #include <kpushbutton.h>
  24.  
  25. namespace KNS
  26. {
  27.  
  28. class DownloadDialog;
  29.  
  30. /**
  31.  * KHotNewStuff push button that makes using KHNS in an application
  32.  * more convenient by encapsulating most of the details involved in
  33.  * using KHotNewStuff in the button itself.
  34.  *
  35.  * @since 3.4
  36.  */
  37. class Button : public KPushButton
  38. {
  39.     Q_OBJECT
  40.  
  41.     public:
  42.         /**
  43.          * Constructor used when the details of the KHotNewStuff
  44.          * download is known when the button is created.
  45.          *
  46.          * @param what text describing what is being downloaded. will be
  47.          *        shown on the button as "Download New <what>"
  48.          * @param providerList the URL to the list of providers; if empty
  49.          *        we first try the ProvidersUrl from KGlobal::config, then we
  50.          *        fall back to a hardcoded value
  51.          * @param resourceType the Hotstuff data type for this downlaod such
  52.          *        as "korganizer/calendar"
  53.          * @param parent the parent widget
  54.          * @param name the name to be used for this widget
  55.          */
  56.         Button(const QString& what,
  57.                const QString& providerList,
  58.                const QString& resourceType,
  59.                QWidget* parent, const char* name);
  60.  
  61.         /**
  62.          * Constructor used when the details of the KHotNewStuff
  63.          * download is not known in advance of the button being created.
  64.          *
  65.          * @param parent the parent widget
  66.          * @param name the name to be used for this widget
  67.          */
  68.         Button(QWidget* parent, const char* name);
  69.  
  70.         /**
  71.          * set the URL to the list of providers for this button to use
  72.          */
  73.         void setProviderList(const QString& providerList);
  74.  
  75.         /**
  76.          * the Hotstuff data type for this downlaod such as
  77.          * "korganizer/calendar"
  78.          */
  79.         void setResourceType(const QString& resourceType);
  80.  
  81.         /**
  82.          * set the text that should appear on the button. will be prefaced
  83.          * with i18n("Download New")
  84.          */
  85.         void setButtonText(const QString& what);
  86.  
  87.     signals:
  88.         /**
  89.          * emitted when the Hot New Stuff dialog is about to be shown, usually
  90.          * as a result of the user having click on the button
  91.          */
  92.         void aboutToShowDialog();
  93.  
  94.         /**
  95.          * emitted when the Hot New Stuff dialog has been closed
  96.          */
  97.         void dialogFinished();
  98.  
  99.     protected slots:
  100.         void showDialog();
  101.  
  102.     private:
  103.         void init();
  104.  
  105.         class ButtonPrivate;
  106.         ButtonPrivate* d;
  107.  
  108.         QString m_providerList;
  109.         QString m_type;
  110.         DownloadDialog* m_downloadDialog;
  111. };
  112.  
  113. }
  114.  
  115. #endif
  116.