summaryrefslogtreecommitdiffstats
path: root/knewsticker/newssourcedlgimpl.h
blob: 71bb69646477a36794cccb3c932841aaeb2093be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * newssourcedlgimpl.h
 *
 * Copyright (c) 2001 Frerich Raabe <raabe@kde.org>
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
 * accompanying file 'COPYING'.
 */
#ifndef NEWSSOURCEDLGIMPL_H
#define NEWSSOURCEDLGIMPL_H
#include "newssourcedlg.h"
#include "newsengine.h"

#include <kdialogbase.h>
#include <kurl.h>

#include <qpixmap.h>

class XMLNewsSource;
class NewsIconMgr;
class QProgressBar;
class QTimer;

class SuggestProgressDlg : public KDialogBase
{
	Q_OBJECT

	public:
		SuggestProgressDlg(const KURL &url, QWidget *parent, const char *name = 0);
		virtual ~SuggestProgressDlg();

		XMLNewsSource *xmlSrc() { return m_xmlSrc; }
		QPixmap icon() const { return m_icon; }
		const KURL &iconURL() const { return m_iconURL; }

	private slots:
		void slotTimeoutTick();
		void slotLoadComplete(XMLNewsSource *, bool);
		void slotGotIcon(const KURL &, const QPixmap &);

	private:
		bool m_gotSourceFile;
		bool m_gotIcon;
		XMLNewsSource  *m_xmlSrc;
		bool m_succeeded;
		QPixmap m_icon;
		KURL m_iconURL;
		QProgressBar *m_progressBar;
		QTimer *m_timeoutTimer;
};

class NewsSourceDlgImpl : public NewsSourceDlg
{ 
	Q_OBJECT

	public:
		NewsSourceDlgImpl(QWidget * = 0, const char * = 0, bool = FALSE, WFlags = 0);

		void setup(const NewsSourceBase::Data &, bool);

	signals:
		void newsSource(const NewsSourceBase::Data &);

	protected slots:
		void slotCancelClicked();
		void slotOkClicked();
		void slotSourceFileChanged();
		void slotSuggestClicked();
		void slotModified();
		KURL polishedURL(const KURL &) const;
		bool validateURL(const KURL &);

	private slots:
		void slotGotIcon(const KURL &, const QPixmap &);

	private:
		bool           m_modified;
};

#endif // NEWSSOURCEDLGIMPL_H