File indexing completed on 2024-05-05 05:13:02
0001 /* 0002 This file is part of Akregator. 0003 0004 SPDX-FileCopyrightText: 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0007 */ 0008 0009 #pragma once 0010 0011 #include "feed.h" 0012 #include "ui_feedpropertieswidgetbase.h" 0013 0014 #include <QDialog> 0015 0016 #include <QWidget> 0017 0018 namespace Akregator 0019 { 0020 class FeedPropertiesWidget : public QWidget, public Ui::FeedPropertiesWidgetBase 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit FeedPropertiesWidget(QWidget *parent = nullptr, const QString &name = QString()); 0025 ~FeedPropertiesWidget() override; 0026 0027 enum IntervalStep { 0028 Minutes = 0, 0029 Hours, 0030 Days, 0031 Never, 0032 }; 0033 0034 public Q_SLOTS: 0035 void slotUpdateComboBoxActivated(int index); 0036 void slotUpdateComboBoxLabels(int value); 0037 void slotUpdateCheckBoxToggled(bool enabled); 0038 }; 0039 0040 class FeedPropertiesDialog : public QDialog 0041 { 0042 Q_OBJECT 0043 public: 0044 explicit FeedPropertiesDialog(QWidget *parent = nullptr, const QString &name = QString()); 0045 ~FeedPropertiesDialog() override; 0046 0047 void setFeed(Feed *feed); 0048 0049 /** selects the text in the feed title lineedit */ 0050 void selectFeedName(); 0051 0052 public Q_SLOTS: 0053 0054 void accept() override; 0055 0056 protected: 0057 [[nodiscard]] QString comment() const; 0058 [[nodiscard]] QString feedName() const; 0059 [[nodiscard]] QString url() const; 0060 [[nodiscard]] bool autoFetch() const; 0061 [[nodiscard]] int fetchInterval() const; 0062 [[nodiscard]] Feed::ArchiveMode archiveMode() const; 0063 [[nodiscard]] int maxArticleAge() const; 0064 [[nodiscard]] int maxArticleNumber() const; 0065 [[nodiscard]] bool markImmediatelyAsRead() const; 0066 [[nodiscard]] bool useNotification() const; 0067 [[nodiscard]] bool loadLinkedWebsite() const; 0068 0069 void setFeedName(const QString &title); 0070 void setUrl(const QString &url); 0071 void setAutoFetch(bool); 0072 void setFetchInterval(int); 0073 void setArchiveMode(Feed::ArchiveMode mode); 0074 void setMaxArticleAge(int age); 0075 void setMaxArticleNumber(int number); 0076 void setMarkImmediatelyAsRead(bool enabled); 0077 void setUseNotification(bool enabled); 0078 void setLoadLinkedWebsite(bool enabled); 0079 0080 void setComment(const QString &comment); 0081 0082 private: 0083 FeedPropertiesWidget *widget = nullptr; 0084 Feed *m_feed = nullptr; 0085 QPushButton *mOkButton = nullptr; 0086 0087 private Q_SLOTS: 0088 void slotSetWindowTitle(const QString &); 0089 }; 0090 } // namespace Akregator