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

KNewStuff

  • knewstuff
  • knewstuff3
knewstuff3/downloaddialog.cpp
Go to the documentation of this file.
1/*
2 knewstuff3/ui/downloaddialog.cpp.
3 Copyright (C) 2005 by Enrico Ros <eros.kde@email.it>
4 Copyright (C) 2005 - 2007 Josef Spillner <spillner@kde.org>
5 Copyright (C) 2007 Dirk Mueller <mueller@kde.org>
6 Copyright (C) 2007-2009 Jeremy Whiting <jpwhiting@kde.org>
7 Copyright (C) 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include "downloaddialog.h"
24
25#include <QtCore/QTimer>
26#include <QtGui/QSortFilterProxyModel>
27#include <QtGui/QScrollBar>
28#include <QtGui/QKeyEvent>
29
30#include <kmessagebox.h>
31#include <kcomponentdata.h>
32#include <kaboutdata.h>
33#include <kpushbutton.h>
34#include <ktitlewidget.h>
35#include <kdebug.h>
36
37#include "downloadwidget.h"
38#include "downloadwidget_p.h"
39
40namespace KNS3 {
41class DownloadDialogPrivate
42{
43public:
44 ~DownloadDialogPrivate()
45 {
46 delete downloadWidget;
47 }
48
49 DownloadWidget* downloadWidget;
50};
51}
52
53using namespace KNS3;
54
55const char * ConfigGroup = "DownloadDialog Settings";
56
57
58DownloadDialog::DownloadDialog(QWidget* parent)
59 : KDialog(parent)
60 , d(new DownloadDialogPrivate)
61{
62 KComponentData component = KGlobal::activeComponent();
63 QString name = component.componentName();
64 init(name + ".knsrc");
65}
66
67DownloadDialog::DownloadDialog(const QString& configFile, QWidget * parent)
68 : KDialog(parent)
69 , d(new DownloadDialogPrivate)
70{
71 init(configFile);
72}
73
74void DownloadDialog::init(const QString& configFile)
75{
76 // load the last size from config
77 KConfigGroup group(KGlobal::config(), ConfigGroup);
78 restoreDialogSize(group);
79 setMinimumSize(700, 400);
80
81 setCaption(i18n("Get Hot New Stuff"));
82 setButtons(KDialog::None);
83
84 d->downloadWidget = new DownloadWidget(configFile ,this);
85 setMainWidget(d->downloadWidget);
86
87 d->downloadWidget->d->ui.m_titleWidget->setText(i18nc("Program name followed by 'Add On Installer'",
88 "%1 Add-On Installer",
89 KGlobal::activeComponent().aboutData()->programName()));
90 d->downloadWidget->d->ui.m_titleWidget->setPixmap(KIcon(KGlobal::activeComponent().aboutData()->programIconName()));
91 d->downloadWidget->d->ui.m_titleWidget->setVisible(true);
92 d->downloadWidget->d->ui.closeButton->setVisible(true);
93 d->downloadWidget->d->ui.closeButton->setGuiItem(KStandardGuiItem::Close);
94 d->downloadWidget->d->dialogMode = true;
95 connect(d->downloadWidget->d->ui.closeButton, SIGNAL(clicked()), this, SLOT(accept()));
96}
97
98DownloadDialog::~DownloadDialog()
99{
100 KConfigGroup group(KGlobal::config(), ConfigGroup);
101 saveDialogSize(group, KConfigBase::Persistent);
102 delete d;
103}
104
105Entry::List DownloadDialog::changedEntries()
106{
107 return d->downloadWidget->changedEntries();
108}
109
110Entry::List DownloadDialog::installedEntries()
111{
112 return d->downloadWidget->installedEntries();
113}
114
115
116#include "downloaddialog.moc"
KComponentData
KComponentData::componentName
QString componentName() const
KConfigBase::Persistent
Persistent
KConfigGroup
KDialog
KDialog::setMainWidget
void setMainWidget(QWidget *widget)
KDialog::saveDialogSize
void saveDialogSize(KConfigGroup &config, KConfigGroup::WriteConfigFlags options=KConfigGroup::Normal) const
KDialog::restoreDialogSize
void restoreDialogSize(const KConfigGroup &config)
KDialog::setButtons
void setButtons(ButtonCodes buttonMask)
KDialog::None
None
KDialog::setCaption
virtual void setCaption(const QString &caption)
KIcon
KNS3::DownloadDialog::DownloadDialog
DownloadDialog(QWidget *parent=0)
Create a DownloadDialog that lets the user install, update and uninstall contents.
Definition: knewstuff3/downloaddialog.cpp:58
KNS3::DownloadDialog::installedEntries
KNS3::Entry::List installedEntries()
The list of entries that have been newly installed.
Definition: knewstuff3/downloaddialog.cpp:110
KNS3::DownloadDialog::~DownloadDialog
~DownloadDialog()
destructor
Definition: knewstuff3/downloaddialog.cpp:98
KNS3::DownloadDialog::changedEntries
KNS3::Entry::List changedEntries()
The list of entries with changed status (installed/uninstalled)
Definition: knewstuff3/downloaddialog.cpp:105
KNS3::DownloadWidget
KNewStuff download widget.
Definition: downloadwidget.h:73
QList
QWidget
downloadwidget.h
downloadwidget_p.h
kaboutdata.h
kcomponentdata.h
kdebug.h
i18n
QString i18n(const char *text)
i18nc
QString i18nc(const char *ctxt, const char *text)
kmessagebox.h
ConfigGroup
const char * ConfigGroup
Definition: knewstuff2/ui/downloaddialog.cpp:52
ConfigGroup
const char * ConfigGroup
Definition: knewstuff3/downloaddialog.cpp:55
downloaddialog.h
kpushbutton.h
ktitlewidget.h
KGlobal::config
KSharedConfigPtr config()
KGlobal::activeComponent
KComponentData activeComponent()
group
group
KNS3
Definition: atticaprovider.cpp:36
name
const char * name(StandardAction id)
KStandardGuiItem::Close
Close
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
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