• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

libkdepim

  • sources
  • kde-4.12
  • kdepim
  • libkdepim
  • prefs
kprefsdialog.h
Go to the documentation of this file.
1 /*
2  This file is part of libkdepim.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6  Copyright (C) 2005,2008,2011 Allen Winter <winter@kde.org>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 #ifndef KDEPIM_KPREFSDIALOG_H
24 #define KDEPIM_KPREFSDIALOG_H
25 
26 #include "kdepim_export.h"
27 
28 #define KDE3_SUPPORT
29 #include <KCModule>
30 #undef KDE3_SUPPORT
31 #include <KConfigSkeleton>
32 #include <KFile>
33 #include <KLineEdit>
34 #include <KPageDialog>
35 
36 #include <QVariantList>
37 
38 class KColorButton;
39 class KComboBox;
40 class KComponentData;
41 class KDateComboBox;
42 class KTimeComboBox;
43 class KUrlRequester;
44 
45 class QCheckBox;
46 class QLabel;
47 class QSpinBox;
48 class QTimeEdit;
49 class QButtonGroup;
50 class QGroupBox;
51 
52 namespace KPIM {
53 
63 class KDEPIM_EXPORT KPrefsWid : public QObject
64 {
65  Q_OBJECT
66  public:
71  virtual void readConfig() = 0;
76  virtual void writeConfig() = 0;
77 
81  virtual QList<QWidget *> widgets() const;
82 
83  Q_SIGNALS:
87  void changed();
88 };
89 
96 class KDEPIM_EXPORT KPrefsWidBool : public KPrefsWid
97 {
98  public:
105  explicit KPrefsWidBool( KConfigSkeleton::ItemBool *item, QWidget *parent = 0 );
106 
110  QCheckBox *checkBox();
111 
112  void readConfig();
113  void writeConfig();
114 
115  QList<QWidget *> widgets() const;
116 
117  private:
118  KConfigSkeleton::ItemBool *mItem;
119 
120  QCheckBox *mCheck;
121 };
122 
130 class KDEPIM_EXPORT KPrefsWidInt : public KPrefsWid
131 {
132  public:
140  explicit KPrefsWidInt( KConfigSkeleton::ItemInt *item, QWidget *parent = 0 );
141 
145  QLabel *label();
146 
150  QSpinBox *spinBox();
151 
152  void readConfig();
153  void writeConfig();
154 
155  QList<QWidget *> widgets() const;
156 
157  private:
158  KConfigSkeleton::ItemInt *mItem;
159 
160  QLabel *mLabel;
161  QSpinBox *mSpin;
162 };
163 
171 class KDEPIM_EXPORT KPrefsWidTime : public KPrefsWid
172 {
173  public:
180  explicit KPrefsWidTime( KConfigSkeleton::ItemDateTime *item, QWidget *parent = 0 );
181 
185  QLabel *label();
186 
190  KTimeComboBox *timeEdit();
191 
192  void readConfig();
193  void writeConfig();
194 
195  private:
196  KConfigSkeleton::ItemDateTime *mItem;
197 
198  QLabel *mLabel;
199  KTimeComboBox *mTimeEdit;
200 };
201 
209 class KDEPIM_EXPORT KPrefsWidDuration : public KPrefsWid
210 {
211  public:
220  explicit KPrefsWidDuration( KConfigSkeleton::ItemDateTime *item, const QString &format, QWidget *parent = 0 );
221 
225  QLabel *label();
229  QTimeEdit *timeEdit();
230 
231  void readConfig();
232  void writeConfig();
233 
234  private:
235  KConfigSkeleton::ItemDateTime *mItem;
236 
237  QLabel *mLabel;
238  QTimeEdit *mTimeEdit;
239 };
240 
248 class KDEPIM_EXPORT KPrefsWidDate : public KPrefsWid
249 {
250  public:
257  explicit KPrefsWidDate( KConfigSkeleton::ItemDateTime *item, QWidget *parent = 0 );
258 
262  QLabel *label();
263 
267  KDateComboBox *dateEdit();
268 
269  void readConfig();
270  void writeConfig();
271 
272  private:
273  KConfigSkeleton::ItemDateTime *mItem;
274 
275  QLabel *mLabel;
276  KDateComboBox *mDateEdit;
277 };
278 
286 class KDEPIM_EXPORT KPrefsWidColor : public KPrefsWid
287 {
288  Q_OBJECT
289  public:
297  explicit KPrefsWidColor( KConfigSkeleton::ItemColor *item, QWidget *parent = 0 );
298 
302  ~KPrefsWidColor();
303 
307  QLabel *label();
311  KColorButton *button();
312 
313  void readConfig();
314  void writeConfig();
315 
316  private:
317  KConfigSkeleton::ItemColor *mItem;
318 
319  QLabel *mLabel;
320  KColorButton *mButton;
321 };
322 
329 class KDEPIM_EXPORT KPrefsWidFont : public KPrefsWid
330 {
331  Q_OBJECT
332  public:
341  explicit KPrefsWidFont( KConfigSkeleton::ItemFont *item,
342  QWidget *parent = 0, const QString &sampleText = QString() );
346  ~KPrefsWidFont();
347 
351  QLabel *label();
352 
356  QFrame *preview();
357 
361  QPushButton *button();
362 
363  void readConfig();
364  void writeConfig();
365 
366  protected Q_SLOTS:
367  void selectFont();
368 
369  private:
370  KConfigSkeleton::ItemFont *mItem;
371 
372  QLabel *mLabel;
373  QLabel *mPreview;
374  QPushButton *mButton;
375 };
376 
388 class KDEPIM_EXPORT KPrefsWidRadios : public KPrefsWid
389 {
390  public:
398  explicit KPrefsWidRadios( KConfigSkeleton::ItemEnum *item, QWidget *parent = 0 );
399  virtual ~KPrefsWidRadios();
400 
409  void addRadio( int value,
410  const QString &text,
411  const QString &toolTip = QString(),
412  const QString &whatsThis = QString() );
413 
417  QGroupBox *groupBox() const;
418 
419  void readConfig();
420  void writeConfig();
421 
422  QList<QWidget *> widgets() const;
423 
424  private:
425  KConfigSkeleton::ItemEnum *mItem;
426 
427  QGroupBox *mBox;
428  QButtonGroup *mGroup;
429 };
430 
441 class KDE_EXPORT KPrefsWidCombo : public KPrefsWid
442 {
443  public:
451  explicit KPrefsWidCombo( KConfigSkeleton::ItemEnum *item, QWidget *parent );
452  virtual ~KPrefsWidCombo();
453 
454  void readConfig();
455  void writeConfig();
456 
457  KComboBox *comboBox();
458  QList<QWidget *> widgets() const;
459 
460  private:
461  KConfigSkeleton::ItemEnum *mItem;
462  KComboBox *mCombo;
463 };
464 
472 class KDEPIM_EXPORT KPrefsWidString : public KPrefsWid
473 {
474  public:
483  explicit KPrefsWidString( KConfigSkeleton::ItemString *item,
484  QWidget *parent = 0,
485  KLineEdit::EchoMode echomode=KLineEdit::Normal );
489  virtual ~KPrefsWidString();
490 
494  QLabel *label();
498  KLineEdit *lineEdit();
499 
500  void readConfig();
501  void writeConfig();
502 
503  QList<QWidget *> widgets() const;
504 
505  private:
506  KConfigSkeleton::ItemString *mItem;
507 
508  QLabel *mLabel;
509  KLineEdit *mEdit;
510 };
511 
519 class KDEPIM_EXPORT KPrefsWidPath : public KPrefsWid
520 {
521  public:
531  explicit KPrefsWidPath( KConfigSkeleton::ItemPath *item,
532  QWidget *parent = 0,
533  const QString &filter = QString(),
534  KFile::Modes = KFile::File );
535 
539  virtual ~KPrefsWidPath();
540 
544  QLabel *label();
545 
549  KUrlRequester *urlRequester();
550 
551  void readConfig();
552  void writeConfig();
553 
554  QList<QWidget *> widgets() const;
555 
556  private:
557  KConfigSkeleton::ItemPath *mItem;
558 
559  QLabel *mLabel;
560  KUrlRequester *mURLRequester;
561 };
562 
571 class KDEPIM_EXPORT KPrefsWidManager
572 {
573  public:
579  explicit KPrefsWidManager( KConfigSkeleton *prefs );
580 
584  virtual ~KPrefsWidManager();
585 
586  KConfigSkeleton *prefs() const { return mPrefs; }
587 
591  virtual void addWid( KPrefsWid * );
592 
599  KPrefsWidBool *addWidBool( KConfigSkeleton::ItemBool *item,
600  QWidget *parent = 0 );
601 
608  KPrefsWidInt *addWidInt( KConfigSkeleton::ItemInt *item,
609  QWidget *parent = 0 );
610 
617  KPrefsWidDate *addWidDate( KConfigSkeleton::ItemDateTime *item,
618  QWidget *parent = 0 );
619 
626  KPrefsWidTime *addWidTime( KConfigSkeleton::ItemDateTime *item,
627  QWidget *parent = 0 );
628 
636  KPrefsWidDuration *addWidDuration( KConfigSkeleton::ItemDateTime *item,
637  const QString &format,
638  QWidget *parent = 0 );
639 
646  KPrefsWidColor *addWidColor( KConfigSkeleton::ItemColor *item,
647  QWidget *parent = 0 );
648 
656  KPrefsWidRadios *addWidRadios( KConfigSkeleton::ItemEnum *item,
657  QWidget *parent = 0 );
658 
666  KPrefsWidCombo *addWidCombo( KConfigSkeleton::ItemEnum *item,
667  QWidget *parent = 0 );
668 
675  KPrefsWidString *addWidString( KConfigSkeleton::ItemString *item,
676  QWidget *parent = 0 );
677 
686  KPrefsWidPath *addWidPath ( KConfigSkeleton::ItemPath *item,
687  QWidget *parent = 0,
688  const QString &filter = QString(),
689  KFile::Modes mode = KFile::File );
690 
697  KPrefsWidString *addWidPassword ( KConfigSkeleton::ItemString *item,
698  QWidget *parent = 0 );
699 
708  KPrefsWidFont *addWidFont( KConfigSkeleton::ItemFont *item,
709  QWidget *parent = 0,
710  const QString &sampleText = QString() );
711 
713  void setWidDefaults();
714 
716  void readWidConfig();
717 
719  void writeWidConfig();
720 
721  private:
722  KConfigSkeleton *mPrefs;
723 
724  QList<KPrefsWid*> mPrefsWids;
725 };
726 
739 class KDEPIM_EXPORT KPrefsDialog : public KPageDialog, public KPrefsWidManager
740 {
741  Q_OBJECT
742  public:
751  explicit KPrefsDialog( KConfigSkeleton *prefs, QWidget *parent = 0,
752  bool modal = false );
753 
757  virtual ~KPrefsDialog();
758 
759  void autoCreate();
760 
761  public Q_SLOTS:
763  void setDefaults();
764 
766  void readConfig();
767 
769  void writeConfig();
770 
771  Q_SIGNALS:
773  void configChanged();
774 
775  protected Q_SLOTS:
777  void slotApply();
778 
780  void slotOk();
781 
783  void slotDefault();
784 
785  protected:
787  virtual void usrReadConfig() {}
789  virtual void usrWriteConfig() {}
790 };
791 
792 class KDEPIM_EXPORT KPrefsModule : public KCModule, public KPrefsWidManager
793 {
794  Q_OBJECT
795  public:
796  KPrefsModule( KConfigSkeleton *, const KComponentData &instance,
797  QWidget *parent=0, const QVariantList &args=QVariantList() );
798 
799  virtual void addWid( KPrefsWid * );
800 
801  void load();
802  void save();
803  void defaults();
804 
805  protected Q_SLOTS:
806  void slotWidChanged();
807 
808  protected:
810  virtual void usrReadConfig() {}
812  virtual void usrWriteConfig() {}
813 };
814 
815 }
816 
817 #endif
KPIM::KPrefsModule::usrWriteConfig
virtual void usrWriteConfig()
Implement this to write custom configuration widgets.
Definition: kprefsdialog.h:812
KPIM::KPrefsModule::usrReadConfig
virtual void usrReadConfig()
Implement this to read custom configuration widgets.
Definition: kprefsdialog.h:810
kdepim_export.h
KPageDialog
KPIM::KPrefsWidTime
Widgets for time settings in KPrefsDialog.
Definition: kprefsdialog.h:171
QWidget
QObject
KPIM::KPrefsWidCombo
Widgets for settings represented by a combo box in KPrefsDialog.
Definition: kprefsdialog.h:441
KPIM::KPrefsWidManager
Class for managing KPrefsWid objects.
Definition: kprefsdialog.h:571
KPIM::KPrefsWidDuration
Widgets for duration settings in KPrefsDialog.
Definition: kprefsdialog.h:209
KPIM::KPrefsWidBool
Widgets for bool settings in KPrefsDialog.
Definition: kprefsdialog.h:96
KPIM::KPrefsModule
Definition: kprefsdialog.h:792
KPIM::KPrefsWidFont
Widgets for font settings in KPrefsDialog.
Definition: kprefsdialog.h:329
KPIM::KPrefsWidDate
Widgets for time settings in KPrefsDialog.
Definition: kprefsdialog.h:248
KPIM::KPrefsDialog::usrWriteConfig
virtual void usrWriteConfig()
Implement this to write custom configuration widgets.
Definition: kprefsdialog.h:789
KPIM::KPrefsDialog
Base class for a preferences dialog.
Definition: kprefsdialog.h:739
KPIM::KPrefsDialog::usrReadConfig
virtual void usrReadConfig()
Implement this to read custom configuration widgets.
Definition: kprefsdialog.h:787
KPIM::KPrefsWidInt
Widgets for int settings in KPrefsDialog.
Definition: kprefsdialog.h:130
KLineEdit
KPIM::KPrefsWidPath
Widgets for string settings in KPrefsDialog.
Definition: kprefsdialog.h:519
KPIM::KPrefsWidColor
Widgets for color settings in KPrefsDialog.
Definition: kprefsdialog.h:286
KPIM::KPrefsWidRadios
Widgets for settings represented by a group of radio buttons in KPrefsDialog.
Definition: kprefsdialog.h:388
QLabel
KPIM::KPrefsWid
Base class for GUI control elements used by KPrefsDialog.
Definition: kprefsdialog.h:63
KPIM::KPrefsWidManager::prefs
KConfigSkeleton * prefs() const
Definition: kprefsdialog.h:586
KComboBox
QFrame
KDEPIM_EXPORT
#define KDEPIM_EXPORT
Definition: kdepim_export.h:35
KCModule
KPIM::KPrefsWidString
Widgets for string settings in KPrefsDialog.
Definition: kprefsdialog.h:472
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdepim

Skip menu "libkdepim"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal