KNewStuff
knewstuffbutton.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 KNS::Engine::download();
00089
00090 emit dialogFinished();
00091 }
00092
00093 }
00094
00095 #include "knewstuffbutton.moc"