knewstuff Library API Documentation

knewstuffbutton.h

00001 /*
00002     Copyright (c) 2004 Aaron J. Seigo <aseigo@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef _khotnewbutton_h
00021 #define _khotnewbutton_h
00022 
00023 #include <kpushbutton.h>
00024 
00025 namespace KNS
00026 {
00027 
00028 class DownloadDialog;
00029 
00030 /*
00031  * KHotNewStuff push button that makes using KHNS in an application
00032  * more convenient by encapsulating most of the details involved in
00033  * using KHotNewStuff in the button itself.
00034  */
00035 class Button : public KPushButton
00036 {
00037     Q_OBJECT
00038 
00039     public:
00040         /*
00041          * Constructor used when the details of the KHotNewStuff
00042          * download is known when the button is created.
00043          *
00044          * @param what text describing what is being downloaded. will be
00045          *        shown on the button as "Download New <what>"
00046          * @param providerList the URL to the list of providers; if empty
00047          *        we first try the ProvidersUrl from KGlobal::config, then we
00048          *        fall back to a hardcoded value
00049          * @param resourceType the Hotstuff data type for this downlaod such
00050          *        as "korganizer/calendar"
00051          * @param parent the parent widget
00052          * @param name the name to be used for this widget
00053          */
00054         Button(const QString& what,
00055                const QString& providerList,
00056                const QString& resourceType,
00057                QWidget* parent, const char* name);
00058 
00059         /*
00060          * Constructor used when the details of the KHotNewStuff
00061          * download is not known in advance of the button being created.
00062          *
00063          * @param parent the parent widget
00064          * @param name the name to be used for this widget
00065          */
00066         Button(QWidget* parent, const char* name);
00067 
00068         /*
00069          * set the URL to the list of providers for this button to use
00070          */
00071         void setProviderList(const QString& providerList);
00072 
00073         /*
00074          * the Hotstuff data type for this downlaod such as
00075          * "korganizer/calendar"
00076          */
00077         void setResourceType(const QString& resourceType);
00078 
00079         /*
00080          * set the text that should appear on the button. will be prefaced
00081          * with i18n("Download New")
00082          */
00083         void setButtonText(const QString& what);
00084 
00085     signals:
00086         /*
00087          * emitted when the Hot New Stuff dialog is about to be shown, usually
00088          * as a result of the user having click on the button
00089          */
00090         void aboutToShowDialog();
00091 
00092         /*
00093          * emitted when the Hot New Stuff dialog has been closed
00094          */
00095         void dialogFinished();
00096 
00097     protected slots:
00098         void showDialog();
00099 
00100     private:
00101         void init();
00102 
00103         class ButtonPrivate;
00104         ButtonPrivate* d;
00105 
00106         QString m_providerList;
00107         QString m_type;
00108         DownloadDialog* m_downloadDialog;
00109 };
00110 
00111 }
00112 
00113 #endif
KDE Logo
This file is part of the documentation for knewstuff Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 28 01:39:03 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003