~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/database/databaseurl.h

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ============================================================
2
 
 *
3
 
 * This file is a part of digiKam project
4
 
 * http://www.digikam.org
5
 
 *
6
 
 * Date        : 2007-03-19
7
 
 * Description : Handling of database specific URLs
8
 
 *
9
 
 * Copyright (C) 2007-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10
 
 *
11
 
 * This program is free software; you can redistribute it
12
 
 * and/or modify it under the terms of the GNU General
13
 
 * Public License as published by the Free Software Foundation;
14
 
 * either version 2, or (at your option)
15
 
 * any later version.
16
 
 *
17
 
 * This program is distributed in the hope that it will be useful,
18
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
 * GNU General Public License for more details.
21
 
 *
22
 
 * ============================================================ */
23
 
 
24
 
#ifndef DATABASEURL_H
25
 
#define DATABASEURL_H
26
 
 
27
 
// Qt includes
28
 
 
29
 
#include <QDateTime>
30
 
#include <QList>
31
 
 
32
 
// KDE includes
33
 
 
34
 
#include <kurl.h>
35
 
 
36
 
// Local includes
37
 
 
38
 
#include "digikam_export.h"
39
 
#include "databaseparameters.h"
40
 
#include "databaseaccess.h"
41
 
 
42
 
namespace Digikam
43
 
{
44
 
 
45
 
class DIGIKAM_DATABASE_EXPORT DatabaseUrl : public KUrl
46
 
{
47
 
public:
48
 
 
49
 
    /**
50
 
      * This class shall facilitate the usage of
51
 
      * digikamalbums:/, digikamtags:/, digikamdates:/ and digikamsearch: URLs.
52
 
      * It provides functions to set and get the parameters stored in such a URL.
53
 
      * (with the exception of the search parameters in a search URL, which
54
 
      *  are out of the scope of this class.)
55
 
      */
56
 
 
57
 
    /**
58
 
      * Create a digikamalbums:/ URL from a file:// URL.
59
 
      * The file URL can point to a file or a directory (an album in this case).
60
 
      * The additional information stored in the URL need to be supplied as well:
61
 
      * - The album root in which the entity pointed to is stored.
62
 
      *   This is the left part of the file URL.
63
 
      *   (if the file is "/media/fotos/Summer 2007/001.jpg", the album root may be "/media/fotos")
64
 
      * - The parameters of the database that is referenced
65
 
      */
66
 
    static DatabaseUrl fromFileUrl(const KUrl& fileUrl,
67
 
                                   const KUrl& albumRoot,
68
 
                                   int   albumRootId,
69
 
                                   const DatabaseParameters& parameters = DatabaseAccess::parameters());
70
 
 
71
 
    static DatabaseUrl fromFileUrl(const KUrl& fileUrl,
72
 
                                   const KUrl& albumRoot,
73
 
                                   const DatabaseParameters& parameters = DatabaseAccess::parameters());
74
 
 
75
 
    /**
76
 
     * Create a digikamalbums:/ url from an album name and an image in this album.
77
 
     * If name is empty, the album is referenced.
78
 
     * Other parameters as above.
79
 
     */
80
 
    static DatabaseUrl fromAlbumAndName(const QString& name,
81
 
                                        const QString& album,
82
 
                                        const KUrl& albumRoot,
83
 
                                        int   albumRootId,
84
 
                                        const DatabaseParameters& parameters = DatabaseAccess::parameters());
85
 
 
86
 
    static DatabaseUrl fromAlbumAndName(const QString& name,
87
 
                                        const QString& album,
88
 
                                        const KUrl& albumRoot,
89
 
                                        const DatabaseParameters& parameters = DatabaseAccess::parameters());
90
 
 
91
 
    /**
92
 
     * Create an empty digikamalbums:/ url
93
 
     */
94
 
    static DatabaseUrl albumUrl(const DatabaseParameters& parameters = DatabaseAccess::parameters());
95
 
 
96
 
    /**
97
 
     * Create a digikamtags:/ url from a list of tag IDs, where this list is the tag hierarchy
98
 
     * of the referenced tag, with the topmost parent first, and the tag last in the list.
99
 
     * An empty list references the root tag.
100
 
     */
101
 
    static DatabaseUrl fromTagIds(const QList<int>& tagIds,
102
 
                                  const DatabaseParameters& parameters = DatabaseAccess::parameters());
103
 
 
104
 
    /**
105
 
     * Create an empty digikamdates:/ url
106
 
     */
107
 
    static DatabaseUrl dateUrl(const DatabaseParameters& parameters = DatabaseAccess::parameters());
108
 
 
109
 
    /**
110
 
     * Create a digikamdates:/ url for the month of the given date.
111
 
     * (The whole month of the given date will included in the referenced time span)
112
 
     */
113
 
    static DatabaseUrl fromDateForMonth(const QDate& date,
114
 
                                        const DatabaseParameters& parameters = DatabaseAccess::parameters());
115
 
 
116
 
    /**
117
 
     * Create a digikamdates:/ url for the year of the given date.
118
 
     * (The whole year of the given date will included in the referenced time span)
119
 
     */
120
 
    static DatabaseUrl fromDateForYear(const QDate& date,
121
 
                                       const DatabaseParameters& parameters = DatabaseAccess::parameters());
122
 
 
123
 
    /**
124
 
     * Create a digikamdates:/ url for a specified time span which begin with the
125
 
     * start date (inclusive) and ends before the end date (exclusive).
126
 
     * To cover the whole year of 1984, you would pass 1/1/1984 and 1/1/1985.
127
 
     */
128
 
    static DatabaseUrl fromDateRange(const QDate& startDate, const QDate& endDate,
129
 
                                     const DatabaseParameters& parameters = DatabaseAccess::parameters());
130
 
 
131
 
    /**
132
 
     * Create a digikamsearch: URL for the search with the given id.
133
 
     */
134
 
    static DatabaseUrl searchUrl(int searchId,
135
 
                                 const DatabaseParameters& parameters = DatabaseAccess::parameters());
136
 
    /**
137
 
      * Create a DatabaseUrl object from a KUrl, to retrieve the information stored
138
 
      */
139
 
    DatabaseUrl(const KUrl& digikamUrl);
140
 
 
141
 
    /**
142
 
     * Create an invalid database URL
143
 
     */
144
 
    DatabaseUrl();
145
 
 
146
 
    /**
147
 
     * These test for the protocol of this URL.
148
 
     * The protocol string is of course available via protocol().
149
 
     */
150
 
    bool isAlbumUrl() const;
151
 
    bool isTagUrl() const;
152
 
    bool isDateUrl() const;
153
 
    bool isSearchUrl() const;
154
 
 
155
 
    /**
156
 
     * Returns the DatabaseParameters stored in this URL.
157
 
     * Applicable to all protocols.
158
 
     */
159
 
    DatabaseParameters parameters() const;
160
 
    /**
161
 
     * Change the database parameters stored in this URL
162
 
     * Applicable to all protocols.
163
 
     */
164
 
    void setParameters(const DatabaseParameters& parameters);
165
 
 
166
 
    /**
167
 
     * The following methods are only applicable for a certain protocol each.
168
 
     * If the URL has another protocol, the return value of these methods is undefined.
169
 
     */
170
 
 
171
 
    /// Album URL
172
 
 
173
 
    /** Returns the album root URL of the file or album referenced by this URL
174
 
     *  In the example above, this is "file://media/fotos"
175
 
     */
176
 
    KUrl albumRoot() const;
177
 
 
178
 
    /** Returns the album root path of the file or album referenced by this URL
179
 
     *  In the example above, this is "/media/fotos"
180
 
     */
181
 
    QString albumRootPath() const;
182
 
 
183
 
    /** Returns the album root id */
184
 
    int albumRootId() const;
185
 
 
186
 
    /** Returns the album: This is the directory hierarchy below the album root.
187
 
     *  In the example above, the album is "/Summer 2007"
188
 
     */
189
 
    QString album() const;
190
 
 
191
 
    /**
192
 
     * Returns the file name. In the example above, this is "001.jpg"
193
 
     */
194
 
    QString name() const;
195
 
 
196
 
    /**
197
 
     * Converts this digikamalbums:// URL to a file:// URL
198
 
     */
199
 
    KUrl fileUrl() const;
200
 
 
201
 
    /// Tag URL
202
 
 
203
 
    /**
204
 
     * Returns the tag ID, or -1 if the root tag is referenced
205
 
     */
206
 
    int tagId() const;
207
 
 
208
 
    /**
209
 
     * Returns the tag ids of all tags in the tag path of this tag,
210
 
     * the topmost tag in the hierarchy first.
211
 
     */
212
 
    QList<int> tagIds() const;
213
 
 
214
 
    /// Date URL
215
 
 
216
 
    /**
217
 
     * Return the referenced start date (included in the referenced span)
218
 
     */
219
 
    QDate startDate() const;
220
 
 
221
 
    /**
222
 
     * Return the referenced end date (excluded from the referenced span)
223
 
     */
224
 
    QDate endDate() const;
225
 
 
226
 
    /// Search URL
227
 
 
228
 
    /**
229
 
     * Return the id of the search.
230
 
     */
231
 
    int searchId() const;
232
 
 
233
 
    DatabaseUrl(const DatabaseUrl& url);
234
 
 
235
 
    DatabaseUrl& operator=(const KUrl& digikamalbumsUrl);
236
 
    DatabaseUrl& operator=(const DatabaseUrl& url);
237
 
 
238
 
    bool operator==(const KUrl& digikamalbumsUrl);
239
 
};
240
 
 
241
 
}  // namespace Digikam
242
 
 
243
 
#endif // DATABASEURL_H