french -> French
[kdepim.git] / knode / knconfigwidgets.h
blob75c10c7163d00e9ff79a2c144ecd200b095d7ed9
1 /*
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>
22 #include <kcmodule.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"
30 class KComboBox;
32 namespace Sonnet{
33 class ConfigWidget;
36 namespace KPIM {
37 class KScoringEditorWidget;
40 namespace Kpgp {
41 class Config;
44 class KNArticleFilter;
45 class KNDisplayedHeader;
46 class KNFilterManager;
48 namespace KNode {
49 class Cleanup;
50 class DisplayedHeaders;
51 class GroupCleanupWidget;
52 class IdentityWidget;
55 namespace KNode {
57 /** News server account list widget. */
58 class KNODE_EXPORT NntpAccountListWidget : public KCModule, private Ui::NntpAccountListWidgetBase
60 Q_OBJECT
62 public:
63 /** Create a new NNTP account list widget. */
64 explicit NntpAccountListWidget( const KComponentData &inst, QWidget *parent = 0 );
66 /** Reimplemented from KCModule. */
67 virtual void load();
69 protected:
70 /** Account list widget item. */
71 class AccountListItem : public QListWidgetItem {
72 public:
73 /** Creates a new account list item.
74 * @param a The account.
76 explicit AccountListItem( KNNntpAccount::Ptr a )
77 : mAccount( a )
79 /** Returns the account assiciated with this item. */
80 KNNntpAccount::Ptr account() const
81 { return mAccount; }
82 private:
83 KNNntpAccount::Ptr mAccount;
86 public slots:
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 );
100 protected slots:
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
118 Q_OBJECT
120 public:
121 explicit NntpAccountConfDialog( KNNntpAccount *a, QWidget *parent = 0 );
122 ~NntpAccountConfDialog();
124 protected slots:
125 void slotServerTextEdited();
126 void slotEditingFinished();
127 virtual void slotButtonClicked( int button );
129 private slots:
130 void slotPasswordChanged();
132 Changes the port to follow change of the encryption selection.
134 void encryptionChanged( bool checked );
136 private:
137 KNNntpAccount *mAccount;
138 IdentityWidget* mIdentityWidget;
139 GroupCleanupWidget *mCleanupWidget;
140 bool mUseServerForName;
144 /** Appearance configuration widget. */
145 class KNODE_EXPORT AppearanceWidget : public KCModule
147 Q_OBJECT
149 public:
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. */
157 virtual void load();
158 /** Reimplemented from KCModule. */
159 virtual void save();
160 /** Reimplemented from KCModule. */
161 virtual void defaults();
163 //===================================================================================
165 /** Color list view item. */
166 class KNODE_EXPORT ColorListItem : public QListWidgetItem {
168 public:
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 );
180 private:
181 /// The current color.
182 QColor mColor;
185 //===================================================================================
187 /** Font list view item. */
188 class KNODE_EXPORT FontListItem : public QListWidgetItem {
190 public:
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 );
204 private:
205 /// The current font.
206 QFont mFont;
207 /// The item text.
208 QString mText;
211 //===================================================================================
213 protected:
214 /// The color selection list.
215 QListWidget *mColorList;
216 /// The font selection list.
217 QListWidget *mFontList;
218 QCheckBox *c_olorCB,
219 *f_ontCB;
220 QPushButton *c_olChngBtn,
221 *f_ntChngBtn;
223 protected slots:
224 //colors
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();
233 //fonts
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
250 public:
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. */
257 virtual void load();
258 /** Reimplemented from KCModule. */
259 virtual void save();
263 /** Read news navigation configuration page. */
264 class KNODE_EXPORT ReadNewsNavigationWidget : public KCModule
266 public:
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
277 public:
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 {
288 Q_OBJECT
290 public:
291 DisplayedHeadersWidget( DisplayedHeaders *d, const KComponentData &inst, QWidget *parent = 0 );
293 /** Reimplemented from KCModule. */
294 virtual void load();
295 /** Reimplemented from KCModule. */
296 virtual void save();
298 protected:
300 /** Header list view item. */
301 class HdrItem : public QListWidgetItem {
303 public:
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; }
311 private:
312 KNDisplayedHeader *mHdr;
315 HdrItem* generateItem(KNDisplayedHeader *);
317 QListWidget *mHeaderList;
318 QPushButton *a_ddBtn,
319 *d_elBtn,
320 *e_ditBtn,
321 *u_pBtn,
322 *d_ownBtn;
323 bool s_ave;
325 DisplayedHeaders *d_ata;
327 protected slots:
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 {
341 Q_OBJECT
343 public:
344 explicit DisplayedHeaderConfDialog( KNDisplayedHeader *h, QWidget *parent = 0 );
345 ~DisplayedHeaderConfDialog();
348 protected:
349 KNDisplayedHeader *h_dr;
350 KComboBox *h_drC;
351 KLineEdit *n_ameE;
352 QCheckBox *n_ameCB[4],
353 *v_alueCB[4];
356 protected slots:
357 void slotOk();
358 void slotActivated(int);
359 void slotNameChanged(const QString&);
363 /** Scoring configuration widget. */
364 class KNODE_EXPORT ScoringWidget : public KCModule
366 public:
367 /** Create a new scoring configuration widget.
368 * @param parent The QWidget parent.
370 explicit ScoringWidget( const KComponentData &inst, QWidget *parent = 0 );
372 private:
373 KPIM::KScoringEditorWidget *mKsc;
374 KIntSpinBox *mIgnored, *mWatched;
378 /** Configuration widget for filters. */
379 class KNODE_EXPORT FilterListWidget : public KCModule {
381 Q_OBJECT
383 public:
384 explicit FilterListWidget( const KComponentData &inst, QWidget *parent = 0 );
385 ~FilterListWidget();
387 void load();
388 void save();
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();
398 protected:
399 /** Filter list view item. */
400 class FilterListItem : public QListWidgetItem {
401 public:
402 /** Create new filter list item.
403 * @param filter The associated filter object.
404 * @param text The text to display in the item.
405 * */
406 FilterListItem( KNArticleFilter *filter, const QString &text ) : QListWidgetItem( text ), mFilter( filter ) {}
407 /** Returns the associated filter. */
408 KNArticleFilter* filter() const { return mFilter; }
409 private:
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,
423 *d_elBtn,
424 *e_ditBtn,
425 *c_opyBtn,
426 *u_pBtn,
427 *d_ownBtn,
428 *s_epAddBtn,
429 *s_epRemBtn;
431 QPixmap a_ctive,
432 d_isabled;
434 KNFilterManager *f_ilManager;
437 protected slots:
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
455 Q_OBJECT
456 public:
457 /** Create a new configuration widget for technical posting settings. */
458 explicit PostNewsTechnicalWidget( const KComponentData &inst, QWidget *parent = 0 );
460 /** Reimplemented from KCModule. */
461 virtual void load();
462 /** Reimplemented from KCModule. */
463 virtual void save();
465 private slots:
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
477 public:
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 );
483 /** Destructor. */
484 ~XHeaderConfDialog();
486 /** Returns the entered/modified header. */
487 QString result() const;
489 private:
490 KLineEdit *mNameEdit, *mValueEdit;
494 /** Composer configuration widget. */
495 class KNODE_EXPORT PostNewsComposerWidget : public KCModule
497 public:
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 {
508 public:
509 explicit PostNewsSpellingWidget( const KComponentData &inst, QWidget *parent = 0 );
510 ~PostNewsSpellingWidget();
512 void save();
514 protected:
515 Sonnet::ConfigWidget *c_conf;
520 /** Privacy configuration widget. */
521 class KNODE_EXPORT PrivacyWidget : public KCModule {
523 Q_OBJECT
525 public:
526 explicit PrivacyWidget( const KComponentData &inst, QWidget *parent = 0 );
527 ~PrivacyWidget();
529 void save();
531 protected:
532 Kpgp::Config *c_onf;
537 //BEGIN: Cleanup configuration -----------------------------------------------
539 /** Configuration widget for group expireration */
540 class KNODE_EXPORT GroupCleanupWidget : public QWidget {
542 Q_OBJECT
544 public:
545 explicit GroupCleanupWidget( Cleanup *data, QWidget *parent = 0 );
547 void load();
548 void save();
550 signals:
551 void changed();
553 private:
554 QCheckBox *mDefault, *mExpEnabled, *mExpUnavailable, *mPreserveThreads;
555 KIntSpinBox *mExpDays, *mExpReadDays, *mExpUnreadDays;
556 QGroupBox *mExpGroup;
557 Cleanup *mData;
559 private slots:
560 void slotDefaultToggled( bool state );
564 /** Global cleanup configuration widget */
565 class KNODE_EXPORT CleanupWidget : public KCModule {
567 Q_OBJECT
569 public:
570 explicit CleanupWidget( const KComponentData &inst, QWidget *parent = 0 );
571 ~CleanupWidget();
573 void load();
574 void save();
576 protected:
577 QCheckBox *f_olderCB;
578 KIntSpinBox *f_olderDays;
579 QLabel *f_olderDaysL;
581 Cleanup *d_ata;
584 protected slots:
585 void slotFolderCBtoggled(bool b);
587 private:
588 GroupCleanupWidget *mGroupCleanup;
592 //END: Cleanup configuration -------------------------------------------------
594 } //KNode
596 #endif //KNCONFIGWIDGETS_H