1 /* ============================================================
2 * QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader
3 * Copyright (C) 2011-2020 QuiteRSS Team <quiterssteam@gmail.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 * ============================================================ */
18 #ifndef ADDFEEDDIALOG_H
19 #define ADDFEEDDIALOG_H
20 
21 #ifdef HAVE_QT5
22 #include <QtWidgets>
23 #else
24 #include <QtGui>
25 #include <QWizard>
26 #endif
27 #include <QtSql>
28 
29 #include "lineedit.h"
30 #include "updatefeeds.h"
31 
32 class AddFeedWizard : public QWizard
33 {
34   Q_OBJECT
35 public:
36   explicit AddFeedWizard(QWidget *parent, int curFolderId);
37   ~AddFeedWizard();
38 
39   void setUrlFeed(const QString &feedUrl);
40 
41   LineEdit *nameFeedEdit_;
42   LineEdit *urlFeedEdit_;
43   QString htmlUrlString_;
44   QString feedUrlString_;
45   int feedId_;
46   int feedParentId_;
47   int newCount_;
48 
49 public slots:
50   void getUrlDone(int result, int feedId, QString feedUrlStr,
51                   QString error, QByteArray data,
52                   QDateTime dtReply, QString codecName);
53   void slotUpdateFeed(int feedId, bool, int newCount, QString);
54 
55 signals:
56   void xmlReadyParse(QByteArray data, int feedId,
57                      QDateTime dtReply, QString codecName);
58   void signalRequestUrl(int feedId, QString urlString,
59                         QDateTime date, QString userInfo);
60 
61 protected:
62   virtual bool validateCurrentPage();
63   virtual void done(int result);
64   void changeEvent(QEvent *event);
65 
66 private slots:
67   void urlFeedEditChanged(const QString&);
68   void nameFeedEditChanged(const QString&);
69   void backButtonClicked();
70   void nextButtonClicked();
71   void finishButtonClicked();
72   void slotCurrentIdChanged(int);
73   void titleFeedAsNameStateChanged(int);
74   void slotProgressBarUpdate();
75   void newFolder();
76 
77 private:
78   void addFeed();
79   void deleteFeed();
80   void showProgressBar();
81   void finish();
82 
83   UpdateFeeds *updateFeeds_;
84   QWizardPage *createUrlFeedPage();
85   QWizardPage *createNameFeedPage();
86   QCheckBox *titleFeedAsName_;
87   QGroupBox *authentication_;
88   LineEdit *user_;
89   LineEdit *pass_;
90   QLabel *textWarning;
91   QWidget *warningWidget_;
92   QProgressBar *progressBar_;
93   bool selectedPage;
94   bool finishOn;
95   QTreeWidget *foldersTree_;
96   int curFolderId_;
97 
98 };
99 
100 #endif // ADDFEEDDIALOG_H
101