• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KNewStuff

knewstuffbutton.cpp

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include <kiconloader.h>
00021 #include <klocale.h>
00022 
00023 #include "downloaddialog.h"
00024 #include "knewstuffbutton.h"
00025 #include "knewstuffbutton.moc"
00026 
00027 namespace KNS
00028 {
00029 
00030 Button::Button(const QString& what,
00031                const QString& providerList,
00032                const QString& resourceType,
00033                QWidget* parent, const char* name)
00034     : KPushButton(parent, name),
00035       d(0),
00036       m_providerList(providerList),
00037       m_type(resourceType),
00038       m_downloadDialog(0)
00039 {
00040     setButtonText(what);
00041     init();
00042 }
00043 
00044 Button::Button(QWidget* parent, const char* name)
00045     : KPushButton(parent, name),
00046       d(0),
00047       m_downloadDialog(0)
00048 {
00049     setButtonText(i18n("Download New Stuff"));
00050     init();
00051 }
00052 
00053 void Button::init()
00054 {
00055     setIconSet(SmallIconSet("knewstuff"));
00056     connect(this, SIGNAL(clicked()), SLOT(showDialog()));
00057 }
00058 
00059 void Button::setButtonText(const QString& what)
00060 {
00061     setText(i18n("Download New %1").arg(what));
00062 }
00063 
00064 void Button::setProviderList(const QString& providerList)
00065 {
00066     m_providerList = providerList;
00067 }
00068 
00069 void Button::setResourceType(const QString& resourceType)
00070 {
00071     m_type = resourceType;
00072 }
00073 
00074 void Button::showDialog()
00075 {
00076     emit aboutToShowDialog();
00077 
00078     if (!m_downloadDialog)
00079     {
00080         m_downloadDialog = new DownloadDialog(0, this);
00081     }
00082 
00083     m_downloadDialog->setType(m_type);
00084     m_downloadDialog->load(m_providerList);
00085 
00086     m_downloadDialog->exec(); // TODO: make non-modal?
00087     emit dialogFinished();
00088 }
00089 
00090 }

KNewStuff

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal