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

tdenewstuff

  • tdenewstuff
providerdialog.cpp
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include <tqlayout.h>
22#include <tqstring.h>
23#include <tqlabel.h>
24
25#include <tdelistview.h>
26#include <tdelocale.h>
27#include <tdemessagebox.h>
28
29#include "engine.h"
30#include "provider.h"
31
32#include "providerdialog.h"
33#include "providerdialog.moc"
34
35using namespace KNS;
36
37class ProviderItem : public TDEListViewItem
38{
39 public:
40 ProviderItem( TDEListView *parent, Provider *provider ) :
41 TDEListViewItem( parent ), mProvider( provider )
42 {
43 setText( 0, provider->name() );
44 }
45
46 Provider *provider() { return mProvider; }
47
48 private:
49 Provider *mProvider;
50};
51
52ProviderDialog::ProviderDialog( Engine *engine, TQWidget *parent ) :
53 KDialogBase( Plain, i18n("Hot New Stuff Providers"), Ok | Cancel, Cancel,
54 parent, 0, false, true ),
55 mEngine( engine )
56{
57 TQFrame *topPage = plainPage();
58
59 TQBoxLayout *topLayout = new TQVBoxLayout( topPage );
60
61 TQLabel *description = new TQLabel( i18n("Please select one of the providers listed below:"), topPage );
62 topLayout->addWidget( description );
63
64 mListView = new TDEListView( topPage );
65 mListView->addColumn( i18n("Name") );
66 topLayout->addWidget( mListView );
67}
68
69void ProviderDialog::clear()
70{
71 mListView->clear();
72}
73
74void ProviderDialog::addProvider( Provider *provider )
75{
76 new ProviderItem( mListView, provider );
77 if ( mListView->childCount() == 1 ) {
78 mListView->setSelected(mListView->firstChild(), true);
79 } else if (mListView->childCount() > 1) {
80 mListView->setSelected(mListView->firstChild(), false);
81 }
82}
83
84void ProviderDialog::slotOk()
85{
86 ProviderItem *item = static_cast<ProviderItem *>( mListView->selectedItem() );
87 if ( !item ) {
88 KMessageBox::error( this, i18n("No provider selected.") );
89 return;
90 }
91
92 mEngine->requestMetaInformation( item->provider() );
93
94 accept();
95}
KNS::Engine
Central class combining all possible TDENewStuff operations.
Definition: engine.h:53
KNS::Engine::requestMetaInformation
void requestMetaInformation(Provider *provider)
Asynchronous lookup of provider information such as upload and download locations,...
Definition: engine.cpp:276
KNS::ProviderDialog::addProvider
void addProvider(Provider *)
Adds a Hotstuff provider to the list.
Definition: providerdialog.cpp:74
KNS::ProviderDialog::clear
void clear()
Clears the list of providers.
Definition: providerdialog.cpp:69
KNS::Provider
TDENewStuff provider container.
Definition: provider.h:48
KNS::Provider::name
TQString name() const
Retrieves the common name of the provider.
Definition: provider.cpp:115
KNS
Handles security releated issues, like signing, verifying.
Definition: downloaddialog.h:37

tdenewstuff

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

tdenewstuff

Skip menu "tdenewstuff"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdenewstuff by doxygen 1.9.4
This website is maintained by Timothy Pearson.