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
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
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 KNS::Engine::download();
00091
00092 emit dialogFinished();
00093 }
00094
00095 }
00096
00097 #include "knewstuffbutton.moc"