karm

preferences.h

00001 #ifndef KARM_PREFERENCES_H
00002 #define KARM_PREFERENCES_H
00003 
00004 #include <kdialogbase.h>
00005 
00006 class TQCheckBox;
00007 class TQLabel;
00008 class TQSpinBox;
00009 class TQString;
00010 class KURLRequester;
00011 
00016 class Preferences :public KDialogBase
00017 {
00018   Q_OBJECT
00019   TQ_OBJECT
00020 
00021   public:
00022     static Preferences *instance( const TQString& icsfile = "" );
00023     void disableIdleDetection();
00024 
00025     // Retrive information about settings
00026     bool detectIdleness() const;
00027     int idlenessTimeout() const;
00028     TQString iCalFile() const;
00029     TQString activeCalendarFile() const;
00030     bool autoSave() const;
00031     bool logging() const;
00032     int autoSavePeriod() const;
00033     bool promptDelete() const;
00034     TQString setPromptDelete( bool prompt );
00035     bool displayColumn(int n) const;
00036     TQString userRealName() const;
00037 
00038     void emitSignals();
00039     bool readBoolEntry( const TQString& uid );
00040     void writeEntry( const TQString &key, bool value );
00041     void deleteEntry( const TQString &key );
00042 
00043   public slots:
00044     void showDialog();
00045     void load();
00046     void save();
00047 
00048   signals:
00049     void detectIdleness(bool on);
00050     void idlenessTimeout(int minutes);
00051     void iCalFile(TQString);
00052     void autoSave(bool on);
00053     void autoSavePeriod(int minutes);
00054     void setupChanged();
00055 
00056   protected slots:
00057     virtual void slotOk();
00058     virtual void slotCancel();
00059     void idleDetectCheckBoxChanged();
00060     void autoSaveCheckBoxChanged();
00061 
00062   private:
00063     void makeDisplayPage();
00064     void makeBehaviorPage();
00065     void makeStoragePage();
00066 
00067     Preferences( const TQString& icsfile = "" );
00068     static Preferences *_instance;
00069     bool _unsavedChanges;
00070 
00071     // Widgets
00072     TQCheckBox *_doIdleDetectionW, *_doAutoSaveW, *_promptDeleteW;
00073     TQCheckBox *_displayTimeW, *_displaySessionW,
00074               *_displayTotalTimeW, *_displayTotalSessionW;
00075     TQCheckBox *_loggingW;
00076     TQLabel    *_idleDetectLabelW, *_displayColumnsLabelW;
00077     TQSpinBox  *_idleDetectValueW, *_autoSaveValueW;
00078     KURLRequester *_iCalFileW ;
00079 
00080     // Values
00081     bool _doIdleDetectionV, _doAutoSaveV, _promptDeleteV, _loggingV;
00082     bool _displayColumnV[4];
00083     int  _idleDetectValueV, _autoSaveValueV;
00084     TQString _iCalFileV;
00085 
00087     TQString _userRealName;
00088 };
00089 
00090 #endif // KARM_PREFERENCES_H
00091