Changeset View
Changeset View
Standalone View
Standalone View
bookmarks/kio_bookmarks.cpp
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "kio_bookmarks.h" | 19 | #include "kio_bookmarks.h" | ||
20 | 20 | | |||
21 | #include <stdio.h> | 21 | #include <stdio.h> | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> | ||
23 | 23 | | |||
24 | #include <qregexp.h> | 24 | #include <QRegularExpression> | ||
25 | #include <qtextdocument.h> | 25 | #include <qtextdocument.h> | ||
26 | #include <qurlquery.h> | 26 | #include <qurlquery.h> | ||
27 | 27 | | |||
28 | #include <kshell.h> | 28 | #include <kshell.h> | ||
29 | 29 | | |||
30 | #include <KLocalizedString> | 30 | #include <KLocalizedString> | ||
31 | #include <kconfig.h> | 31 | #include <kconfig.h> | ||
32 | #include <kconfiggroup.h> | 32 | #include <kconfiggroup.h> | ||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Line(s) | 175 | if (folder.parentGroup() == tree && size < 8 && real == false) | |||
176 | size = 8; | 176 | size = 8; | ||
177 | 177 | | |||
178 | return size; | 178 | return size; | ||
179 | } | 179 | } | ||
180 | 180 | | |||
181 | void BookmarksProtocol::get( const QUrl& url ) | 181 | void BookmarksProtocol::get( const QUrl& url ) | ||
182 | { | 182 | { | ||
183 | QString path = url.path(); | 183 | QString path = url.path(); | ||
184 | QRegExp regexp("^/(background|icon)/([\\S]+)"); | 184 | const QRegularExpression regexp(QStringLiteral("^/(background|icon)/([\\S]+)")); | ||
185 | QRegularExpressionMatch rmatch; | ||||
185 | 186 | | |||
186 | if (path.isEmpty() || path == "/") { | 187 | if (path.isEmpty() || path == "/") { | ||
187 | echoIndex(); | 188 | echoIndex(); | ||
188 | } else if (path == "/config") { | 189 | } else if (path == "/config") { | ||
189 | KToolInvocation::startServiceByDesktopName("bookmarks", ""); | 190 | KToolInvocation::startServiceByDesktopName("bookmarks", ""); | ||
190 | echoHead("bookmarks:/"); | 191 | echoHead("bookmarks:/"); | ||
191 | } else if (path == "/editbookmarks") { | 192 | } else if (path == "/editbookmarks") { | ||
192 | KToolInvocation::kdeinitExec("keditbookmarks"); | 193 | KToolInvocation::kdeinitExec("keditbookmarks"); | ||
193 | echoHead("bookmarks:/"); | 194 | echoHead("bookmarks:/"); | ||
194 | } else if (regexp.indexIn(path) >= 0) { | 195 | } else if (path.indexOf(regexp, 0, &rmatch) >= 0) { | ||
195 | echoImage(regexp.cap(1), regexp.cap(2), QUrlQuery(url).queryItemValue("size")); | 196 | echoImage(rmatch.captured(1), rmatch.captured(2), QUrlQuery(url).queryItemValue("size")); | ||
196 | } else { | 197 | } else { | ||
197 | echoHead(); | 198 | echoHead(); | ||
198 | echo("<p class=\"message\">" + i18n("Wrong request: %1", url.toDisplayString().toHtmlEscaped()) + "</p>"); | 199 | echo("<p class=\"message\">" + i18n("Wrong request: %1", url.toDisplayString().toHtmlEscaped()) + "</p>"); | ||
199 | } | 200 | } | ||
200 | finished(); | 201 | finished(); | ||
201 | } | 202 | } | ||
202 | 203 | | |||
203 | extern "C" int Q_DECL_EXPORT kdemain(int argc, char **argv) | 204 | extern "C" int Q_DECL_EXPORT kdemain(int argc, char **argv) | ||
Show All 14 Lines |