File indexing completed on 2024-04-21 15:02:29

0001 /*
0002     knewstuff3/ui/uploaddialog.h.
0003     SPDX-FileCopyrightText: 2002 Cornelius Schumacher <schumacher@kde.org>
0004     SPDX-FileCopyrightText: 2007 Josef Spillner <spillner@kde.org>
0005     SPDX-FileCopyrightText: 2009 Jeremy Whiting <jpwhiting@kde.org>
0006     SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
0007     SPDX-FileCopyrightText: 2021 Dan Leinir Turthra Jensen <admin@leinir.dk>
0008 
0009     SPDX-License-Identifier: LGPL-2.1-or-later
0010 */
0011 #ifndef KNEWSTUFF3_UI_UPLOADDIALOG_H
0012 #define KNEWSTUFF3_UI_UPLOADDIALOG_H
0013 
0014 #include "knewstuff_export.h"
0015 
0016 #if KNEWSTUFF_ENABLE_DEPRECATED_SINCE(5, 85)
0017 
0018 #include <QDialog>
0019 #include <QUrl>
0020 
0021 namespace Attica
0022 {
0023 class BaseJob;
0024 }
0025 
0026 // KDE5: this class should inherit from the wizard class - KAssistantDialog
0027 
0028 namespace KNS3
0029 {
0030 class UploadDialogPrivate;
0031 /**
0032  * @short KNewStuff file upload dialog.
0033  *
0034  * This dialog shows the user how to add new content to the remote service represented
0035  * by the configuration file passed into it.
0036  *
0037  * @note This dialog originally allowed for performing direct uploads to an OCS service,
0038  * however there is no such service available at this time, and it is unlikely we will
0039  * have one any time soon (as we have an issue where such functionality is essentially
0040  * just a vector for directly visible spam). As such, we have decided to let this dialog
0041  * instead reflect reality, and just give information on how to manually perform those
0042  * uploads through a remote service's web based upload system.
0043  *
0044  * \par Maintainer:
0045  * Dan Leinir Turthra Jensen (admin@leinir.dk)
0046  *
0047  * @since 4.4
0048  * @deprecated  Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation. Use KNS3::QtQuickDialogWrapper which
0049  * includes automatic integration for NewStuff.UploadPage
0050  */
0051 class KNEWSTUFF_EXPORT UploadDialog : public QDialog
0052 {
0053     Q_OBJECT
0054 public:
0055     /**
0056       Create a new upload dialog.
0057 
0058       @param parent the parent window
0059       @deprecated  Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation. Use KNS3::QtQuickDialogWrapper which
0060       includes automatic integration for NewStuff.UploadPage. If the OCS backend supports upload, you can use KNSCore::AtticaHelper to do so, or implement it
0061       manually.
0062     */
0063     KNEWSTUFF_DEPRECATED_VERSION(5, 85, "See API documentation")
0064     explicit UploadDialog(QWidget *parent = nullptr);
0065 
0066     /**
0067       Create a new upload dialog.
0068 
0069       @param parent the parent window
0070       @deprecated  Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation. Use KNS3::QtQuickDialogWrapper which
0071       includes automatic integration for NewStuff.UploadPage. If the OCS backend supports upload, you can use KNSCore::AtticaHelper to "
0072         "do so, or implement it manually.
0073     */
0074     KNEWSTUFF_DEPRECATED_VERSION(5, 85, "See API documentation")
0075     explicit UploadDialog(const QString &configFile, QWidget *parent = nullptr);
0076 
0077     /**
0078       Destructor.
0079     */
0080     ~UploadDialog() override;
0081     /**
0082       Set the file to be uploaded.
0083       This has to be set for the dialog to work, before displaying the dialog.
0084 
0085       @param payloadFile the payload data file
0086       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0087      */
0088     void setUploadFile(const QUrl &payloadFile);
0089 
0090     /**
0091       Set the suggested title for the upload.
0092       The application can suggest a title which can then be edited by the user before uploading.
0093       The name field will be left empty if no title was set.
0094 
0095       @param name the suggested name for the upload
0096       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0097      */
0098     void setUploadName(const QString &name);
0099 
0100     /**
0101       Set the suggested version displayed in the upload dialog.
0102       The user can still change this.
0103       @param version
0104       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0105      */
0106     void setVersion(const QString &version);
0107 
0108     /**
0109       Set the suggested description displayed in the upload dialog.
0110       The user can still change this.
0111       @param description
0112       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0113      */
0114     void setDescription(const QString &description);
0115 
0116     /**
0117       Set the suggested changelog displayed in the upload dialog.
0118       The user can still change this.
0119       @param version version
0120       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0121      */
0122     void setChangelog(const QString &changelog);
0123 
0124     /**
0125       Set one of the three preview images displayed in the upload dialog.
0126       The user can still change this.
0127       @param number The number of the preview image to set, either 1, 2, or 3.
0128       @param file A URL to the file to be used as preview image
0129       @since 4.6
0130       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0131      */
0132     void setPreviewImageFile(uint number, const QUrl &file);
0133 
0134     /**
0135      Enable the UI to let the user to set a price for the uploaded item.
0136      @param enabled enable the price option - it is enabled by default
0137      @since 4.5
0138      @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0139      */
0140     void setPriceEnabled(bool enabled);
0141 
0142     /**
0143       Set the suggested price displayed in the upload dialog.
0144       The user can still change this.
0145       @param version version
0146       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0147      */
0148     void setPrice(double price);
0149 
0150     /**
0151       Set the suggested rationale why this item costs something to download.
0152       The user can still change this.
0153       @param version version
0154       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0155      */
0156     void setPriceReason(const QString &reason);
0157 
0158     /**
0159       Set the suggested category for the upload.
0160       The .knsrc file may contain multiple upload categories, this sets which one is pre-selected.
0161       It does not add any new category to the list of available categories.
0162 
0163       @param category the suggested category for the upload
0164       @deprecated Since 5.85, Upload functionality is no longer directly supported and needs complete reimplementation
0165      */
0166     void selectCategory(const QString &category);
0167 
0168 public Q_SLOTS:
0169     void accept() override;
0170 
0171 private:
0172     bool init(const QString &configfile);
0173 
0174     UploadDialogPrivate *const d;
0175 
0176     Q_DISABLE_COPY(UploadDialog)
0177 };
0178 
0179 }
0180 
0181 #endif
0182 
0183 #endif