File indexing completed on 2024-05-05 03:52:17

0001 /*
0002     This file is part of the Nepomuk KDE project.
0003     SPDX-FileCopyrightText: 2010 Sebastian Trueg <trueg@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef BALOO_TIMELINE_TOOLS_H_
0009 #define BALOO_TIMELINE_TOOLS_H_
0010 
0011 class QString;
0012 
0013 #include <QDate>
0014 #include <QUrl>
0015 
0016 namespace Baloo
0017 {
0018 /**
0019  * The hierarchy in timeline:/ looks as follows:
0020  *
0021  * /
0022  * |- /today
0023  * |
0024  * |- /calendar
0025  * |  |- /calendar/2010
0026  * |     |- /calendar/2010/january
0027  * |        |- /calendar/2010/january/2010-01-01
0028  * |  |- /calendar/2009
0029  * |
0030  * |- /months
0031  * |  |- /month/2010
0032  * |     |- /months/2010/january
0033  * |
0034  * |- /weeks
0035  */
0036 enum TimelineFolderType {
0037     NoFolder = 0,    /// nothing
0038     RootFolder,      /// the root folder
0039     CalendarFolder,  /// the calendar folder listing all months
0040     MonthFolder,     /// a folder listing a month's days (m_date contains the month)
0041     DayFolder,       /// a folder listing a day (m_date); optionally m_filename is set
0042 };
0043 
0044 /**
0045  * Parse a timeline URL like timeline:/today and return the type of folder it
0046  * represents. If DayFolder is returned \p date is set to the date that should be listed.
0047  * Otherwise it is an invalid date. \p filename is optionally set to the name of the file
0048  * in the folder.
0049  */
0050 TimelineFolderType parseTimelineUrl(const QUrl& url, QDate* date, QString* filename = nullptr);
0051 
0052 /**
0053   * Remove any double slashes, remove any trailing slashes, and
0054   * add an initial slash after the scheme.
0055   */
0056 QUrl canonicalizeTimelineUrl(const QUrl& url);
0057 
0058 }
0059 
0060 #endif