• Skip to content
  • Skip to link menu
KDE 4.1 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 KNewStuff.
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 Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 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     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "knewstuffbutton.h"
00022 
00023 #include <kiconloader.h>
00024 #include <klocale.h>
00025 #include <kicon.h>
00026 
00027 #include "knewstuff2/engine.h"
00028 
00029 namespace KNS
00030 {
00031 
00032 Button::Button(const QString& what,
00033                const QString& providerList,
00034                const QString& resourceType,
00035                QWidget* parent)
00036         : KPushButton(parent),
00037         d(0),
00038         m_providerList(providerList),
00039         m_type(resourceType),
00040         m_engine(0)
00041 {
00042     setButtonText(what);
00043     init();
00044 }
00045 
00046 Button::Button(QWidget* parent)
00047         : KPushButton(parent),
00048         d(0),
00049         m_engine(0)
00050 {
00051     setButtonText(i18n("Download New Stuff"));
00052     init();
00053 }
00054 
00055 void Button::init()
00056 {
00057     setIcon(KIcon("get-hot-new-stuff"));
00058     connect(this, SIGNAL(clicked()), SLOT(showDialog()));
00059 }
00060 
00061 void Button::setButtonText(const QString& what)
00062 {
00063     setText(i18n("Download New %1", what));
00064 }
00065 
00066 void Button::setProviderList(const QString& providerList)
00067 {
00068     m_providerList = providerList;
00069 }
00070 
00071 void Button::setResourceType(const QString& resourceType)
00072 {
00073     m_type = resourceType;
00074 }
00075 
00076 void Button::showDialog()
00077 {
00078     emit aboutToShowDialog();
00079 
00080     /*if (!m_engine)
00081     {
00082         m_engine = new Engine();
00083     }*/
00084 
00085     //m_downloadDialog->setCategory(m_type);
00086     //m_downloadDialog->load(m_providerList);
00087 
00088     //m_downloadDialog->exec(); // TODO: make non-modal?
00089 
00090     KNS::Engine::download();
00091 
00092     emit dialogFinished();
00093 }
00094 
00095 }
00096 
00097 #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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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