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

KNewStuff

  • sources
  • kde-4.12
  • kdelibs
  • 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 
40 namespace KNS3 {
41 class DownloadDialogPrivate
42 {
43 public:
44  ~DownloadDialogPrivate()
45  {
46  delete downloadWidget;
47  }
48 
49  DownloadWidget* downloadWidget;
50 };
51 }
52 
53 using namespace KNS3;
54 
55 const char * ConfigGroup = "DownloadDialog Settings";
56 
57 
58 DownloadDialog::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 
67 DownloadDialog::DownloadDialog(const QString& configFile, QWidget * parent)
68  : KDialog(parent)
69  , d(new DownloadDialogPrivate)
70 {
71  init(configFile);
72 }
73 
74 void 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 
98 DownloadDialog::~DownloadDialog()
99 {
100  KConfigGroup group(KGlobal::config(), ConfigGroup);
101  saveDialogSize(group, KConfigBase::Persistent);
102  delete d;
103 }
104 
105 Entry::List DownloadDialog::changedEntries()
106 {
107  return d->downloadWidget->changedEntries();
108 }
109 
110 Entry::List DownloadDialog::installedEntries()
111 {
112  return d->downloadWidget->installedEntries();
113 }
114 
115 
116 #include "downloaddialog.moc"
i18n
QString i18n(const char *text)
kdebug.h
ktitlewidget.h
KNS3::DownloadDialog::DownloadDialog
DownloadDialog(QWidget *parent=0)
Create a DownloadDialog that lets the user install, update and uninstall contents.
Definition: knewstuff3/downloaddialog.cpp:58
group
QWidget
name
const char * name(StandardAction id)
KDialog
QString
ConfigGroup
const char * ConfigGroup
Definition: knewstuff3/downloaddialog.cpp:55
i18nc
QString i18nc(const char *ctxt, const char *text)
downloadwidget_p.h
KGlobal::config
KSharedConfigPtr config()
KNS3::DownloadWidget
KNewStuff download widget.
Definition: downloadwidget.h:72
KNS3::DownloadDialog::~DownloadDialog
~DownloadDialog()
destructor
Definition: knewstuff3/downloaddialog.cpp:98
KIcon
KGlobal::activeComponent
KComponentData activeComponent()
KComponentData::componentName
QString componentName() const
KNS3::DownloadDialog::changedEntries
KNS3::Entry::List changedEntries()
The list of entries with changed status (installed/uninstalled)
Definition: knewstuff3/downloaddialog.cpp:105
kpushbutton.h
KConfigGroup
downloadwidget.h
KStandardGuiItem::Close
downloaddialog.h
kaboutdata.h
kcomponentdata.h
kmessagebox.h
KComponentData
KNS3::DownloadDialog::installedEntries
KNS3::Entry::List installedEntries()
The list of entries that have been newly installed.
Definition: knewstuff3/downloaddialog.cpp:110
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:48 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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