1
/***************************************************************************
2
* Copyright (C) 2010 - 2011 by Ingomar Wesp <ingomar@wesp.name> *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18
***************************************************************************/
19
#ifndef QUICKLAUNCH_LAUNCHERDATA_H
20
#define QUICKLAUNCH_LAUNCHERDATA_H
25
#include <QtCore/QMimeData>
26
#include <QtCore/QList>
27
#include <QtCore/QString>
36
namespace Quicklaunch {
39
* The LauncherData class encapsulates all the data necessary to display a
40
* launcher in quicklaunch (url, name, description and an icon). It also
41
* provides methods to read / write from / to QMimeData objects or
48
* Creates an ItemData object from the given @a url and tries to determine
49
* name, description and icon automatically.
51
* @param url the url for the ItemData object
53
LauncherData(const KUrl& url);
56
* Creates a null ItemData object.
62
QString description() const;
65
bool operator == (const LauncherData& other) const;
66
bool operator != (const LauncherData& other) const;
68
void populateMimeData(QMimeData *mimeData);
70
static bool canDecode(const QMimeData *mimeData);
71
static QList<LauncherData> fromMimeData(const QMimeData *mimeData);
76
QString m_description;
80
* Determines whether the given @a bookmarkList contains URLs
81
* (non-empty elements that are neither separators nor groups).
83
* @param bookmarkList a list of bookmarks
85
* @return whether the given @a bookmarkList contains URLs that
86
* can be used to create ItemData objects.
88
static bool hasUrls(const QList<KBookmark> &bookmarkList);
91
* Determines whether the given @a bookmarkGroup contains URLs
92
* (non-empty elements that are neither separators nor groups).
94
* @param a bookmark group
96
* @return whether the given @a bookmarkGroup contains URLs that
97
* can be used to create ItemData objects.
99
static bool hasUrls(const KBookmarkGroup &bookmarkGroup);
101
static QList<KUrl> extractUrls(const QList<KBookmark> &bookmarkList);
102
static QList<KUrl> extractUrls(const KBookmarkGroup &bookmarkGroup);
106
#endif /* QUICKLAUNCH_LAUNCHERDATA_H */