• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • knewstuff
 

knewstuff

  • knewstuff
knewstuffbutton.cpp
1 /*
2  Copyright (c) 2004 Aaron J. Seigo <aseigo@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include <kiconloader.h>
21 #include <klocale.h>
22 
23 #include "downloaddialog.h"
24 #include "knewstuffbutton.h"
25 #include "knewstuffbutton.moc"
26 
27 namespace KNS
28 {
29 
30 Button::Button(const TQString& what,
31  const TQString& providerList,
32  const TQString& resourceType,
33  TQWidget* parent, const char* name)
34  : KPushButton(parent, name),
35  d(0),
36  m_providerList(providerList),
37  m_type(resourceType),
38  m_downloadDialog(0)
39 {
40  setButtonText(what);
41  init();
42 }
43 
44 Button::Button(TQWidget* parent, const char* name)
45  : KPushButton(parent, name),
46  d(0),
47  m_downloadDialog(0)
48 {
49  setButtonText(i18n("Download New Stuff"));
50  init();
51 }
52 
53 void Button::init()
54 {
55  setIconSet(SmallIconSet("knewstuff"));
56  connect(this, TQT_SIGNAL(clicked()), TQT_SLOT(showDialog()));
57 }
58 
59 void Button::setButtonText(const TQString& what)
60 {
61  setText(i18n("Download New %1").arg(what));
62 }
63 
64 void Button::setProviderList(const TQString& providerList)
65 {
66  m_providerList = providerList;
67 }
68 
69 void Button::setResourceType(const TQString& resourceType)
70 {
71  m_type = resourceType;
72 }
73 
74 void Button::showDialog()
75 {
76  emit aboutToShowDialog();
77 
78  if (!m_downloadDialog)
79  {
80  m_downloadDialog = new DownloadDialog(0, this);
81  }
82 
83  m_downloadDialog->setType(m_type);
84  m_downloadDialog->load(m_providerList);
85 
86  m_downloadDialog->exec(); // TODO: make non-modal?
87  emit dialogFinished();
88 }
89 
90 }

knewstuff

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

knewstuff

Skip menu "knewstuff"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for knewstuff by doxygen 1.8.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |