Changeset View
Changeset View
Standalone View
Standalone View
src/contentlist/ContentListerBase.cpp
Show All 15 Lines | |||||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "ContentListerBase.h" | 22 | #include "ContentListerBase.h" | ||
23 | 23 | | |||
24 | #include <QVariantMap> | ||||
25 | #include <QFileInfo> | ||||
26 | #include <QDateTime> | ||||
27 | | ||||
28 | #include <KFileMetaData/UserMetaData> | ||||
29 | | ||||
24 | ContentListerBase::ContentListerBase(QObject* parent) | 30 | ContentListerBase::ContentListerBase(QObject* parent) | ||
25 | : QObject(parent) | 31 | : QObject(parent) | ||
26 | { | 32 | { | ||
27 | } | 33 | } | ||
28 | 34 | | |||
29 | ContentListerBase::~ContentListerBase() | 35 | ContentListerBase::~ContentListerBase() | ||
30 | { | 36 | { | ||
31 | } | 37 | } | ||
32 | 38 | | |||
33 | void ContentListerBase::addLocation(QString path) | | |||
34 | { | | |||
35 | Q_UNUSED(path) | | |||
36 | } | | |||
37 | 39 | | |||
38 | void ContentListerBase::addMimetype(QString mimetype) | 40 | void ContentListerBase::startSearch(const QList<ContentQuery*>& queries) | ||
39 | { | 41 | { | ||
40 | Q_UNUSED(mimetype) | 42 | Q_UNUSED(queries); | ||
41 | } | 43 | } | ||
42 | 44 | | |||
43 | void ContentListerBase::setSearchString(const QString& searchString) | 45 | QVariantMap ContentListerBase::metaDataForFile(const QString& file) | ||
44 | { | 46 | { | ||
45 | Q_UNUSED(searchString) | 47 | QVariantMap metadata; | ||
46 | } | | |||
47 | 48 | | |||
48 | void ContentListerBase::setKnownFiles(QStringList knownFiles) | 49 | //TODO: This should include the same information for both the Baloo and | ||
49 | { | 50 | //File searchers. Unfortunately, currently KFileMetaData does not seem able | ||
50 | Q_UNUSED(knownFiles); | 51 | //to provide this. So this needs changes at a lower level. | ||
51 | } | | |||
52 | 52 | | |||
53 | void ContentListerBase::startSearch() | 53 | QFileInfo info(file); | ||
54 | { | 54 | metadata["lastModified"] = info.lastModified(); | ||
55 | metadata["created"] = info.created(); | ||||
56 | metadata["lastRead"] = info.lastRead(); | ||||
57 | | ||||
58 | KFileMetaData::UserMetaData data(file); | ||||
59 | if (data.hasAttribute("peruse.currentPage")) { | ||||
60 | int currentPage = data.attribute("peruse.currentPage").toInt(); | ||||
61 | metadata["currentPage"] = QVariant::fromValue<int>(currentPage); | ||||
62 | } | ||||
63 | if (data.hasAttribute("peruse.totalPages")) { | ||||
64 | int totalPages = data.attribute("peruse.totalPages").toInt(); | ||||
65 | metadata["totalPages"] = QVariant::fromValue<int>(totalPages); | ||||
55 | } | 66 | } | ||
56 | 67 | | |||
68 | return metadata; | ||||
69 | } |