2 KNode, the KDE newsreader
3 Copyright (c) 1999-2006 the KNode authors.
4 See file AUTHORS for details
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 #ifndef KNCONFIGWIDGETS_H
16 #define KNCONFIGWIDGETS_H
18 #include "knnntpaccount.h"
19 #include "knode_export.h"
21 #include <kpagedialog.h>
24 #include "ui_nntpaccountdialog_base.h"
25 #include "ui_nntpaccountlistwidget_base.h"
26 #include "ui_postnewstechnicalwidget_base.h"
27 #include "ui_readnewsgeneralwidget_base.h"
37 class KScoringEditorWidget
;
44 class KNArticleFilter
;
45 class KNDisplayedHeader
;
46 class KNFilterManager
;
50 class DisplayedHeaders
;
51 class GroupCleanupWidget
;
57 /** News server account list widget. */
58 class KNODE_EXPORT NntpAccountListWidget
: public KCModule
, private Ui::NntpAccountListWidgetBase
63 /** Create a new NNTP account list widget. */
64 explicit NntpAccountListWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
66 /** Reimplemented from KCModule. */
70 /** Account list widget item. */
71 class AccountListItem
: public QListWidgetItem
{
73 /** Creates a new account list item.
74 * @param a The account.
76 explicit AccountListItem( KNNntpAccount::Ptr a
)
79 /** Returns the account assiciated with this item. */
80 KNNntpAccount::Ptr
account() const
83 KNNntpAccount::Ptr mAccount
;
87 /** Add an list view item for the given account.
88 * @param a The new account.
90 void slotAddItem( KNNntpAccount::Ptr a
);
91 /** Remove the list view item of the given account.
92 * @param a The account.
94 void slotRemoveItem( KNNntpAccount::Ptr a
);
95 /** Update the item of the given account.
96 * @param a The account.
98 void slotUpdateItem( KNNntpAccount::Ptr a
);
101 /** Item selection has changed. */
102 void slotSelectionChanged();
103 /** Add account button has been clicked. */
104 void slotAddBtnClicked();
105 /** Delete account button has been clicked. */
106 void slotDelBtnClicked();
107 /** Edit account button has been clicked. */
108 void slotEditBtnClicked();
109 /** Subscribe button has been clicked. */
110 void slotSubBtnClicked();
115 /** News server configuration dialog. */
116 class KNODE_EXPORT NntpAccountConfDialog
: public KPageDialog
, private Ui::NntpAccountDialogBase
121 explicit NntpAccountConfDialog( KNNntpAccount
*a
, QWidget
*parent
= 0 );
122 ~NntpAccountConfDialog();
125 void slotServerTextEdited();
126 void slotEditingFinished();
127 virtual void slotButtonClicked( int button
);
130 void slotPasswordChanged();
132 Changes the port to follow change of the encryption selection.
134 void encryptionChanged( bool checked
);
137 KNNntpAccount
*mAccount
;
138 IdentityWidget
* mIdentityWidget
;
139 GroupCleanupWidget
*mCleanupWidget
;
140 bool mUseServerForName
;
144 /** Appearance configuration widget. */
145 class KNODE_EXPORT AppearanceWidget
: public KCModule
150 /** Create a new appearance configuration widget.
151 * @param inst The KComponentData.
152 * @param parent The parent widget.
154 explicit AppearanceWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
156 /** Reimplemented from KCModule. */
158 /** Reimplemented from KCModule. */
160 /** Reimplemented from KCModule. */
161 virtual void defaults();
163 //===================================================================================
165 /** Color list view item. */
166 class KNODE_EXPORT ColorListItem
: public QListWidgetItem
{
169 /** Create a new color list view item.
170 * @param text The item text.
171 * @param color The item color.
172 * @param parent The list widget this item is shown in.
174 explicit ColorListItem( const QString
&text
, const QColor
&color
= Qt::black
, QListWidget
*parent
= 0 );
175 /** Returns the current color. */
176 const QColor
& color() { return mColor
; }
177 /** Sets the current color. */
178 void setColor( const QColor
&color
);
181 /// The current color.
185 //===================================================================================
187 /** Font list view item. */
188 class KNODE_EXPORT FontListItem
: public QListWidgetItem
{
191 /** Create a new font list view item.
192 * @param text The item text.
193 * @param font The selected font for this item.
194 * @param parent The list widget this item is shown in.
196 FontListItem( const QString
&text
, const QFont
&font
, QListWidget
*parent
= 0 );
197 /** Returns the current font. */
198 const QFont
& font() { return mFont
; }
199 /** Sets the current font.
200 * @param font The new font.
202 void setFont( const QFont
&font
);
205 /// The current font.
211 //===================================================================================
214 /// The color selection list.
215 QListWidget
*mColorList
;
216 /// The font selection list.
217 QListWidget
*mFontList
;
220 QPushButton
*c_olChngBtn
,
225 void slotColCheckBoxToggled(bool b
);
226 /** Show color selection dialog for the given item.
227 * @param item The color list item that has been activated.
229 void slotColItemActivated( QListWidgetItem
*item
);
230 void slotColChangeBtnClicked();
231 void slotColSelectionChanged();
234 void slotFontCheckBoxToggled(bool b
);
235 /** Show font selection dialog for the given item.
236 * @param item The font list item that has been activated.
238 void slotFontItemActivated( QListWidgetItem
*item
);
239 void slotFontChangeBtnClicked();
240 void slotFontSelectionChanged();
245 /** General read news configuration page.
246 * @todo Use KConfigXT also for handling the date format button group.
248 class KNODE_EXPORT ReadNewsGeneralWidget
: public KCModule
, KNode::Ui::ReadNewsGeneralWidgetBase
251 /** Create a new general configuration page.
252 * @param parent The QWidget parent.
254 explicit ReadNewsGeneralWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
256 /** Reimplemented from KCModule. */
258 /** Reimplemented from KCModule. */
263 /** Read news navigation configuration page. */
264 class KNODE_EXPORT ReadNewsNavigationWidget
: public KCModule
267 /** Create a new navigation configuration page.
268 * @param parent The QWidget parent.
270 explicit ReadNewsNavigationWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
274 /** Article viewer configuration page. */
275 class KNODE_EXPORT ReadNewsViewerWidget
: public KCModule
278 /** Create a new article viewer configuration page.
279 * @param parent The QWidget parent.
281 explicit ReadNewsViewerWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
285 /** Configuration widget for headers displayed in the article viewer. */
286 class KNODE_EXPORT DisplayedHeadersWidget
: public KCModule
{
291 DisplayedHeadersWidget( DisplayedHeaders
*d
, const KComponentData
&inst
, QWidget
*parent
= 0 );
293 /** Reimplemented from KCModule. */
295 /** Reimplemented from KCModule. */
300 /** Header list view item. */
301 class HdrItem
: public QListWidgetItem
{
304 /** Creates a new header list view item.
305 * @param text The text to display.
306 * @param header The associated header.
308 HdrItem( const QString
&text
, KNDisplayedHeader
*header
) : QListWidgetItem( text
), mHdr( header
) {}
309 /** Returns the associated header. */
310 KNDisplayedHeader
*header() const { return mHdr
; }
312 KNDisplayedHeader
*mHdr
;
315 HdrItem
* generateItem(KNDisplayedHeader
*);
317 QListWidget
*mHeaderList
;
318 QPushButton
*a_ddBtn
,
325 DisplayedHeaders
*d_ata
;
328 void slotSelectionChanged();
329 void slotAddBtnClicked();
330 void slotDelBtnClicked();
331 void slotEditBtnClicked();
332 void slotUpBtnClicked();
333 void slotDownBtnClicked();
338 /** Configuration dialog for a single header displayed in the article viewer. */
339 class KNODE_EXPORT DisplayedHeaderConfDialog
: public KDialog
{
344 explicit DisplayedHeaderConfDialog( KNDisplayedHeader
*h
, QWidget
*parent
= 0 );
345 ~DisplayedHeaderConfDialog();
349 KNDisplayedHeader
*h_dr
;
352 QCheckBox
*n_ameCB
[4],
358 void slotActivated(int);
359 void slotNameChanged(const QString
&);
363 /** Scoring configuration widget. */
364 class KNODE_EXPORT ScoringWidget
: public KCModule
367 /** Create a new scoring configuration widget.
368 * @param parent The QWidget parent.
370 explicit ScoringWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
373 KPIM::KScoringEditorWidget
*mKsc
;
374 KIntSpinBox
*mIgnored
, *mWatched
;
378 /** Configuration widget for filters. */
379 class KNODE_EXPORT FilterListWidget
: public KCModule
{
384 explicit FilterListWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
390 void addItem(KNArticleFilter
*f
);
391 void removeItem(KNArticleFilter
*f
);
392 void updateItem(KNArticleFilter
*f
);
393 void addMenuItem(KNArticleFilter
*f
);
394 void removeMenuItem(KNArticleFilter
*f
);
395 QList
<int> menuOrder();
399 /** Filter list view item. */
400 class FilterListItem
: public QListWidgetItem
{
402 /** Create new filter list item.
403 * @param filter The associated filter object.
404 * @param text The text to display in the item.
406 FilterListItem( KNArticleFilter
*filter
, const QString
&text
) : QListWidgetItem( text
), mFilter( filter
) {}
407 /** Returns the associated filter. */
408 KNArticleFilter
* filter() const { return mFilter
; }
410 KNArticleFilter
*mFilter
;
413 /** Returns the index of the list view item associated with the given filter.
414 * @param l The list widget to search in.
415 * @param f The filter to search.
417 int findItem( QListWidget
*l
, KNArticleFilter
*f
);
419 QListWidget
*mFilterList
;
420 QListWidget
*mMenuList
;
422 QPushButton
*a_ddBtn
,
434 KNFilterManager
*f_ilManager
;
438 void slotAddBtnClicked();
439 void slotDelBtnClicked();
440 void slotEditBtnClicked();
441 void slotCopyBtnClicked();
442 void slotUpBtnClicked();
443 void slotDownBtnClicked();
444 void slotSepAddBtnClicked();
445 void slotSepRemBtnClicked();
446 void slotSelectionChangedFilter();
447 void slotSelectionChangedMenu();
452 /** Configuration widget for technical posting settings. */
453 class KNODE_EXPORT PostNewsTechnicalWidget
: public KCModule
, KNode::Ui::PostNewsTechnicalWidgetBase
457 /** Create a new configuration widget for technical posting settings. */
458 explicit PostNewsTechnicalWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
460 /** Reimplemented from KCModule. */
462 /** Reimplemented from KCModule. */
466 void slotSelectionChanged();
467 void slotAddBtnClicked();
468 void slotDelBtnClicked();
469 void slotEditBtnClicked();
474 /** Dialog to edit additional headers. */
475 class KNODE_EXPORT XHeaderConfDialog
: public KDialog
478 /** Create a new dialog to edit an additional header.
479 * @param h The header to edit.
480 * @param parent The parent widget.
482 explicit XHeaderConfDialog( const QString
&h
= QString(), QWidget
*parent
= 0 );
484 ~XHeaderConfDialog();
486 /** Returns the entered/modified header. */
487 QString
result() const;
490 KLineEdit
*mNameEdit
, *mValueEdit
;
494 /** Composer configuration widget. */
495 class KNODE_EXPORT PostNewsComposerWidget
: public KCModule
498 /** Create a new composer configuration widget.
499 * @param parent The parent widget.
501 explicit PostNewsComposerWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
505 /** Spell-checking configuration widget. */
506 class KNODE_EXPORT PostNewsSpellingWidget
: public KCModule
{
509 explicit PostNewsSpellingWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
510 ~PostNewsSpellingWidget();
515 Sonnet::ConfigWidget
*c_conf
;
520 /** Privacy configuration widget. */
521 class KNODE_EXPORT PrivacyWidget
: public KCModule
{
526 explicit PrivacyWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
537 //BEGIN: Cleanup configuration -----------------------------------------------
539 /** Configuration widget for group expireration */
540 class KNODE_EXPORT GroupCleanupWidget
: public QWidget
{
545 explicit GroupCleanupWidget( Cleanup
*data
, QWidget
*parent
= 0 );
554 QCheckBox
*mDefault
, *mExpEnabled
, *mExpUnavailable
, *mPreserveThreads
;
555 KIntSpinBox
*mExpDays
, *mExpReadDays
, *mExpUnreadDays
;
556 QGroupBox
*mExpGroup
;
560 void slotDefaultToggled( bool state
);
564 /** Global cleanup configuration widget */
565 class KNODE_EXPORT CleanupWidget
: public KCModule
{
570 explicit CleanupWidget( const KComponentData
&inst
, QWidget
*parent
= 0 );
577 QCheckBox
*f_olderCB
;
578 KIntSpinBox
*f_olderDays
;
579 QLabel
*f_olderDaysL
;
585 void slotFolderCBtoggled(bool b
);
588 GroupCleanupWidget
*mGroupCleanup
;
592 //END: Cleanup configuration -------------------------------------------------
596 #endif //KNCONFIGWIDGETS_H