<commit_before>#ifndef KARM_PREFERENCES_H
#define KARM_PREFERENCES_H

#include <kpagedialog.h>
#include <QLabel>

class QCheckBox;
class QLabel;
class QSpinBox;
class QString;
class KUrlRequester;

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

class Preferences :public KPageDialog
{
  Q_OBJECT

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

    // Retrive information about settings
    bool detectIdleness() const;
    int idlenessTimeout() const;
    QString iCalFile() const;
    QString activeCalendarFile() const;
    bool autoSave() const;
    bool logging() const;
    int autoSavePeriod() const;
    bool promptDelete() const;
    bool uniTasking() const;
    QString setPromptDelete( bool prompt );
    QString setUniTasking( bool b );
    bool displayColumn(int n) const;
    bool decimalFormat() const;
    bool trayIcon() const;
    QString userRealName() const;

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

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

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

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

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

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

    // Widgets
    QCheckBox *_doIdleDetectionW, *_doAutoSaveW, *_promptDeleteW, *_uniTaskingW,
              *_trayIconW;
    QCheckBox *_displayTimeW, *_displaySessionW,
              *_displayTotalTimeW, *_displayTotalSessionW,
	      *_decimalFormatW, *_displayPerCentCompleteW;
    QCheckBox *_loggingW;
    QLabel    *_idleDetectLabelW, *_displayColumnsLabelW;
    QSpinBox  *_idleDetectValueW, *_autoSaveValueW;
    KUrlRequester *_iCalFileW ;

    // Values
    bool _doIdleDetectionV, _doAutoSaveV, _promptDeleteV, _loggingV, _uniTaskingV, _trayIconV;
    bool _displayColumnV[4];
    bool _decimalFormatV;<commit_msg>fix buffer overflow (CID 2458)<commit_after>#ifndef KARM_PREFERENCES_H
#define KARM_PREFERENCES_H

#include <kpagedialog.h>
#include <QLabel>

class QCheckBox;
class QLabel;
class QSpinBox;
class QString;
class KUrlRequester;

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

class Preferences :public KPageDialog
{
  Q_OBJECT

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

    // Retrive information about settings
    bool detectIdleness() const;
    int idlenessTimeout() const;
    QString iCalFile() const;
    QString activeCalendarFile() const;
    bool autoSave() const;
    bool logging() const;
    int autoSavePeriod() const;
    bool promptDelete() const;
    bool uniTasking() const;
    QString setPromptDelete( bool prompt );
    QString setUniTasking( bool b );
    bool displayColumn(int n) const;
    bool decimalFormat() const;
    bool trayIcon() const;
    QString userRealName() const;

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

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

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

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

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

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

    // Widgets
    QCheckBox *_doIdleDetectionW, *_doAutoSaveW, *_promptDeleteW, *_uniTaskingW,
              *_trayIconW;
    QCheckBox *_displayTimeW, *_displaySessionW,
              *_displayTotalTimeW, *_displayTotalSessionW,
	      *_decimalFormatW, *_displayPerCentCompleteW;
    QCheckBox *_loggingW;
    QLabel    *_idleDetectLabelW, *_displayColumnsLabelW;
    QSpinBox  *_idleDetectValueW, *_autoSaveValueW;
    KUrlRequester *_iCalFileW ;

    // Values
    bool _doIdleDetectionV, _doAutoSaveV, _promptDeleteV, _loggingV, _uniTaskingV, _trayIconV;
    bool _displayColumnV[5];
    bool _decimalFormatV;
{'fraction_non_alphanumeric': 0.08727420336919017, 'fraction_numerical': 0.0012177795818956768, 'mean_word_length': 3.7798254122211445, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6929010', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1484, 'n_words': 415}