summaryrefslogtreecommitdiffstats
path: root/karm/preferences.h
blob: adfcd14ecb1c03e76a7d0d6a363433f7064bbad6 (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
83
84
85
86
87
88
89
90
#ifndef KARM_PREFERENCES_H
#define KARM_PREFERENCES_H

#include <kdialogbase.h>

class QCheckBox;
class QLabel;
class QSpinBox;
class QString;
class KURLRequester;

/**
 * Provide an interface to the configuration options for the program.
 */

class Preferences :public KDialogBase
{
  Q_OBJECT

  public:
    static Preferences *instance( const TQString& icsfile = "" );
    void disableIdleDetection();

    // Retrive information about settings
    bool detectIdleness() const;
    int idlenessTimeout() const;
    TQString iCalFile() const;
    TQString activeCalendarFile() const;
    bool autoSave() const;
    bool logging() const;
    int autoSavePeriod() const;
    bool promptDelete() const;
    TQString setPromptDelete( bool prompt );
    bool displayColumn(int n) const;
    TQString userRealName() const;

    void emitSignals();
    bool readBoolEntry( const TQString& uid );
    void writeEntry( const TQString &key, bool value );
    void deleteEntry( const TQString &key );

  public slots:
    void showDialog();
    void load();
    void save();

  signals:
    void detectIdleness(bool on);
    void idlenessTimeout(int minutes);
    void iCalFile(TQString);
    void autoSave(bool on);
    void autoSavePeriod(int minutes);
    void setupChanged();

  protected slots:
    virtual void slotOk();
    virtual void slotCancel();
    void idleDetectCheckBoxChanged();
    void autoSaveCheckBoxChanged();

  private:
    void makeDisplayPage();
    void makeBehaviorPage();
    void makeStoragePage();

    Preferences( const TQString& icsfile = "" );
    static Preferences *_instance;
    bool _unsavedChanges;

    // Widgets
    TQCheckBox *_doIdleDetectionW, *_doAutoSaveW, *_promptDeleteW;
    TQCheckBox *_displayTimeW, *_displaySessionW,
              *_displayTotalTimeW, *_displayTotalSessionW;
    TQCheckBox *_loggingW;
    TQLabel    *_idleDetectLabelW, *_displayColumnsLabelW;
    TQSpinBox  *_idleDetectValueW, *_autoSaveValueW;
    KURLRequester *_iCalFileW ;

    // Values
    bool _doIdleDetectionV, _doAutoSaveV, _promptDeleteV, _loggingV;
    bool _displayColumnV[4];
    int  _idleDetectValueV, _autoSaveValueV;
    TQString _iCalFileV;

    /** real name of the user, used during ICAL saving */
    TQString _userRealName;
};

#endif // KARM_PREFERENCES_H