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

KNewStuff

  • sources
  • kde-4.14
  • kdelibs
  • knewstuff
  • knewstuff2
  • ui
knewstuff2/ui/knewstuffbutton.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KNewStuff2.
3  Copyright (c) 2004 Aaron J. Seigo <aseigo@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include "knewstuffbutton.h"
20 
21 #include <kiconloader.h>
22 #include <klocale.h>
23 #include <kicon.h>
24 
25 #include "knewstuff2/engine.h"
26 
27 namespace KNS
28 {
29 
30 Button::Button(const QString& what,
31  const QString& providerList,
32  const QString& resourceType,
33  QWidget* parent)
34  : KPushButton(parent),
35  d(0),
36  m_providerList(providerList),
37  m_type(resourceType),
38  m_engine(0)
39 {
40  setText(what);
41  init();
42 }
43 
44 Button::Button(QWidget* parent)
45  : KPushButton(parent),
46  d(0),
47  m_engine(0)
48 {
49  setButtonText(i18n("Download New Stuff..."));
50  init();
51 }
52 
53 void Button::init()
54 {
55  setIcon(KIcon("get-hot-new-stuff"));
56  connect(this, SIGNAL(clicked()), SLOT(showDialog()));
57 }
58 
59 void Button::setButtonText(const QString& what)
60 {
61  setText(what);
62 }
63 
64 void Button::setProviderList(const QString& providerList)
65 {
66  m_providerList = providerList;
67 }
68 
69 void Button::setResourceType(const QString& resourceType)
70 {
71  m_type = resourceType;
72 }
73 
74 void Button::showDialog()
75 {
76  emit aboutToShowDialog();
77 
78  /*if (!m_engine)
79  {
80  m_engine = new Engine();
81  }*/
82 
83  //m_downloadDialog->setCategory(m_type);
84  //m_downloadDialog->load(m_providerList);
85 
86  //m_downloadDialog->exec(); // TODO: make non-modal?
87 
88  KNS::Engine::download();
89 
90  emit dialogFinished();
91 }
92 
93 }
94 
95 #include "knewstuffbutton.moc"
KNS::Engine::download
static KNS::Entry::List download()
Recommended download workflow entry point.
Definition: knewstuff2/engine.cpp:176
i18n
QString i18n(const char *text)
KPushButton
QWidget
KNS::Button::setProviderList
void setProviderList(const QString &providerList)
set the URL to the list of providers for this button to use
Definition: knewstuff2/ui/knewstuffbutton.cpp:64
kiconloader.h
KNS::Button::showDialog
void showDialog()
Definition: knewstuff2/ui/knewstuffbutton.cpp:74
klocale.h
KPushButton::setText
void setText(const QString &text)
KNS::Button::Button
Button(const QString &what, const QString &providerList, const QString &resourceType, QWidget *parent)
Constructor used when the details of the KHotNewStuff download is known when the button is created...
Definition: knewstuff2/ui/knewstuffbutton.cpp:30
QAbstractButton::clicked
void clicked(bool checked)
KIcon
KNS::Button::setButtonText
void setButtonText(const QString &what)
set the text that should appear on the button.
Definition: knewstuff2/ui/knewstuffbutton.cpp:59
QString
knewstuffbutton.h
KNS::Button::aboutToShowDialog
void aboutToShowDialog()
emitted when the Hot New Stuff dialog is about to be shown, usually as a result of the user having cl...
KNS::Button::dialogFinished
void dialogFinished()
emitted when the Hot New Stuff dialog has been closed
KPushButton::setIcon
void setIcon(const KIcon &icon)
engine.h
KNS::Button::setResourceType
void setResourceType(const QString &resourceType)
the Hotstuff data type for this downlaod such as "korganizer/calendar"
Definition: knewstuff2/ui/knewstuffbutton.cpp:69
kicon.h
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal