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

KNewStuff

knewstuffbutton.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of KNewStuff2.
00003     Copyright (c) 2004 Aaron J. Seigo <aseigo@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #include "knewstuffbutton.h"
00020 
00021 #include <kiconloader.h>
00022 #include <klocale.h>
00023 #include <kicon.h>
00024 
00025 #include "knewstuff2/engine.h"
00026 
00027 namespace KNS
00028 {
00029 
00030 Button::Button(const QString& what,
00031                const QString& providerList,
00032                const QString& resourceType,
00033                QWidget* parent)
00034         : KPushButton(parent),
00035         d(0),
00036         m_providerList(providerList),
00037         m_type(resourceType),
00038         m_engine(0)
00039 {
00040     setButtonText(what);
00041     init();
00042 }
00043 
00044 Button::Button(QWidget* parent)
00045         : KPushButton(parent),
00046         d(0),
00047         m_engine(0)
00048 {
00049     setButtonText(i18n("Download New Stuff"));
00050     init();
00051 }
00052 
00053 void Button::init()
00054 {
00055     setIcon(KIcon("get-hot-new-stuff"));
00056     connect(this, SIGNAL(clicked()), SLOT(showDialog()));
00057 }
00058 
00059 void Button::setButtonText(const QString& what)
00060 {
00061     setText(i18n("Download New %1", 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_engine)
00079     {
00080         m_engine = new Engine();
00081     }*/
00082 
00083     //m_downloadDialog->setCategory(m_type);
00084     //m_downloadDialog->load(m_providerList);
00085 
00086     //m_downloadDialog->exec(); // TODO: make non-modal?
00087 
00088     KNS::Engine::download();
00089 
00090     emit dialogFinished();
00091 }
00092 
00093 }
00094 
00095 #include "knewstuffbutton.moc"

KNewStuff

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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