1 | /* |
2 | knewstuff3/ui/downloaddialog.h. |
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 | #ifndef KNEWSTUFF3_UI_DOWNLOADDIALOG_H |
24 | #define KNEWSTUFF3_UI_DOWNLOADDIALOG_H |
25 | |
26 | #include <kdialog.h> |
27 | |
28 | #include "knewstuff_export.h" |
29 | #include "entry.h" |
30 | |
31 | namespace KNS3 |
32 | { |
33 | class DownloadDialogPrivate; |
34 | |
35 | /** |
36 | * KNewStuff download dialog. |
37 | * |
38 | * The download dialog will present items to the user |
39 | * for installation, updates and removal. |
40 | * Preview images as well as other meta information can be seen. |
41 | * |
42 | * \section knsrc knsrc Files |
43 | * The Dialog is configured by a .knsrc file containing the KHotNewStuff configuration. |
44 | * Your application should install a file called: <em>$KDEDIR/share/config/appname.knsrc</em> |
45 | * |
46 | * The file could look like this for wallpapers: |
47 | * <pre> |
48 | [KNewStuff3] |
49 | ProvidersUrl=http://download.kde.org/ocs/providers.xml |
50 | Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200 |
51 | StandardResource=wallpaper |
52 | Uncompress=archive |
53 | * </pre> |
54 | * |
55 | * Uncompress can be one of: always, never or archive: |
56 | * <ol> |
57 | * <li>always: assume all downloaded files are archives and need to be extracted</li> |
58 | * <li>never: never try to extract the file</li> |
59 | * <li>archive: if the file is an archive, uncompress it, otherwise just pass it on</li> |
60 | * </ol> |
61 | * |
62 | * You have different options to set the target install directory: |
63 | * <ol><li>StandardResource: standard ressouce dir, such as <em>.kde/share/wallpapers</em>. |
64 | * This is what KStandardDirs::locateLocal(name) will return.</li> |
65 | * <li>TargetDir: a directory in the share/apps section, such as <em>.kde/share/apps/wallpapers</em>. |
66 | * This is what KStandardDirs::locateLocal("data", name) will return.</li> |
67 | * <li>XdgTargetDir: a directory in the $XDG_DATA_HOME directory such as <em>.local/share/wallpapers</em> (since 4.5). |
68 | * </ol> |
69 | * |
70 | * @since 4.4 |
71 | */ |
72 | class KNEWSTUFF_EXPORT DownloadDialog :public KDialog |
73 | { |
74 | Q_OBJECT |
75 | |
76 | public: |
77 | /** |
78 | * Create a DownloadDialog that lets the user install, update and uninstall |
79 | * contents. It will try to find a appname.knsrc file with the configuration. |
80 | * Appname is the name of your application as provided in the about data-> |
81 | * |
82 | * @param parent the parent of the dialog |
83 | */ |
84 | explicit DownloadDialog(QWidget * parent = 0); |
85 | |
86 | /** |
87 | * Create a DownloadDialog that lets the user install, update and uninstall |
88 | * contents. Manually specify the name of a .knsrc file where the |
89 | * KHotNewStuff configuration can be found. |
90 | * |
91 | * @param configFile the name of the configuration file |
92 | * @param parent the parent of the dialog |
93 | */ |
94 | explicit DownloadDialog(const QString& configFile, QWidget * parent = 0); |
95 | |
96 | /** |
97 | * destructor |
98 | */ |
99 | ~DownloadDialog(); |
100 | |
101 | /** |
102 | * The list of entries with changed status (installed/uninstalled) |
103 | * @return the list of entries |
104 | */ |
105 | KNS3::Entry::List changedEntries(); |
106 | |
107 | /** |
108 | * The list of entries that have been newly installed |
109 | * @return the list of entries |
110 | */ |
111 | KNS3::Entry::List installedEntries(); |
112 | |
113 | private: |
114 | void init(const QString& configFile); |
115 | |
116 | DownloadDialogPrivate *const d; |
117 | Q_DISABLE_COPY(DownloadDialog) |
118 | }; |
119 | |
120 | } |
121 | |
122 | #endif |
123 | |