File indexing completed on 2024-04-28 04:58:12

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2023 Stefano Crocco <stefano.crocco@alice.it>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #ifndef LIBKONQ_UTILS_H
0007 #define LIBKONQ_UTILS_H
0008 
0009 #include "libkonq_export.h"
0010 
0011 #include <QUrl>
0012 
0013 class KBookmarkManager;
0014 class QWidget;
0015 
0016 namespace Konq {
0017    LIBKONQ_EXPORT KBookmarkManager* userBookmarksManager();
0018 
0019     /**
0020      * @brief Creates an URL with scheme `error` describing the error occurred while attempting to load an URL
0021      *
0022      * @param error the `KIO` error code (or `KIO::ERR_WORKER_DEFINED` if not from `KIO`)
0023      * @param errorText the text of the error message
0024      * @param initialUrl the URL that we were trying to open
0025      * @return the `error` URL
0026     */
0027     LIBKONQ_EXPORT QUrl makeErrorUrl(int error, const QString &errorText, const QUrl &initialUrl);
0028 
0029     /**
0030      * @brief Displays a `Save as` dialog asking for the location where to download an URL
0031      * @param suggestedFileName the suggested file name for the downloaded file
0032      * @param parent the dialog's parent
0033      * @param the starting directory for the dialog. If omitted, the standard download location will be used
0034      * @return a string with the download path chosen by the user or an empty string if the user cancels the dialog
0035      */
0036     LIBKONQ_EXPORT QString askDownloadLocation(const QString &suggestedFileName, QWidget *parent = nullptr, const QString &startingDir = {});
0037 }
0038 #endif //LIBKONQ_UTILS_H
0039