List Info

Thread: KDE/kdepim/ktimetracker




KDE/kdepim/ktimetracker
user name
2007-07-23 04:16:40
SVN commit 691268 by msoeken:

GUI: Integrate minimum desktop active time into settings
dialog


 M  +2 -4      desktoptracker.cpp  
 M  +22 -9     preferences.cpp  
 M  +4 -3      preferences.h  


--- trunk/KDE/kdepim/ktimetracker/desktoptracker.cpp
#691267:691268
 -26,10
+26,8 
 #include <KWindowSystem>
 
 #include "desktoptracker.h"
+#include "preferences.h"
 
-// TODO: Put in config dialog
-const int minimumInterval = 5;  // seconds
-
 DesktopTracker:esktopTr
acker ()
 {
   // Setup desktop change handling
 -61,7
+59,7 
   // the data file can get huge fast if logging is turned
on.  Then saving
   // get's slower, etc.  There's no benefit in saving a lot
of start/stop 
   // events that are very small.  Wait a bit to make sure
the user is settled.
-  _timer->start( minimumInterval * 1000 );
+  _timer->start(
Preferences::instance()->minimumDesktopActiveTime() *
1000 );
 }
 
 void DesktopTracker::changeTimers()
--- trunk/KDE/kdepim/ktimetracker/preferences.cpp
#691267:691268
 -79,7
+79,7 
 
 void Preferences::makeBehaviorPage()
 {
-  KIcon icon = KIcon( "kcmsystem" );
+  KIcon icon = KIcon( "gear" );
   QFrame* behaviorPage = new QFrame();
   KPageWidgetItem *pageItem = new KPageWidgetItem(
behaviorPage, i18n("Behavior"));
   pageItem->setHeader( i18n("Behavior
Settings") );
 -100,6
+100,12 
   _idleDetectValueW->setObjectName(
"_idleDetectValueW" );
   _idleDetectValueW->setRange(1,30*24);
   _idleDetectValueW->setSuffix(i18n(" min"));
+  _minDesktopActiveTimeLabelW = new QLabel( i18n(
"Minimum desktop active time" ), behaviorPage );
+  _minDesktopActiveTimeLabelW->setObjectName(
"_minDesktopActiveTimeLabel" );
+  _minDesktopActiveTimeValueW = new QSpinBox( behaviorPage
);
+  _minDesktopActiveTimeValueW->setObjectName(
"_minDesktopActiveTimeValue" );
+  _minDesktopActiveTimeValueW->setRange( 1, 60 ); //
TODO what is a good range?
+  _minDesktopActiveTimeValueW->setSuffix( i18n( "
sec" ) );
   _promptDeleteW = new QCheckBox
     ( i18n( "Prompt before deleting tasks" ),
behaviorPage );
   _promptDeleteW->setObjectName(
"_promptDeleteW" );
 -111,11
+117,13 
     ( i18n( "Place an icon to the SysTray" ),
behaviorPage );
   _trayIconW->setObjectName( "_trayIcon" );
 
-  layout->addWidget(_doIdleDetectionW, 0, 0 );
-  layout->addWidget(_idleDetectValueW, 0, 1 );
-  layout->addWidget(_promptDeleteW, 1, 0 );
-  layout->addWidget(_uniTaskingW, 2, 0);
-  layout->addWidget(_trayIconW, 3, 0);
+  layout->addWidget( _doIdleDetectionW, 0, 0 );
+  layout->addWidget( _idleDetectValueW, 0, 1 );
+  layout->addWidget( _minDesktopActiveTimeLabelW, 1, 0
);
+  layout->addWidget( _minDesktopActiveTimeValueW, 1, 1
);
+  layout->addWidget( _promptDeleteW, 2, 0 );
+  layout->addWidget( _uniTaskingW, 3, 0 );
+  layout->addWidget( _trayIconW, 4, 0 );
 
   topLevel->addStretch();
 
 -242,6
+250,7 
 
   _doIdleDetectionW->setChecked(_doIdleDetectionV);
   _idleDetectValueW->setValue(_idleDetectValueV);
+  _minDesktopActiveTimeValueW->setValue(
_minDesktopActiveTimeValueV );
 
   _doAutoSaveW->setChecked(_doAutoSaveV);
   _autoSaveValueW->setValue(_autoSaveValueV);
 -282,6
+291,7 
 
   _doIdleDetectionV = _doIdleDetectionW->isChecked();
   _idleDetectValueV = _idleDetectValueW->value();
+  _minDesktopActiveTimeValueV =
_minDesktopActiveTimeValueW->value();
 
   _doAutoSaveV = _doAutoSaveW->isChecked();
   _autoSaveValueV = _autoSaveValueW->value();
 -336,6
+346,7 
 QString Preferences::activeCalendarFile() 	     const {
return _iCalFileV; }
 bool    Preferences::detectIdleness()                const
{ return _doIdleDetectionV; }
 int     Preferences::idlenessTimeout()               const
{ return _idleDetectValueV; }
+int     Preferences::minimumDesktopActiveTime() const {
return _minDesktopActiveTimeValueV; }
 bool    Preferences::autoSave()                      const
{ return _doAutoSaveV; }
 int     Preferences::autoSavePeriod()                const
{ return _autoSaveValueV; }
 bool    Preferences::logging()                       const
{ return _loggingV; }
 -363,6
+374,7 
   _doIdleDetectionV = configIdleDetection.readEntry(
QString::fromLatin1("enabled"),
      true );
   _idleDetectValueV =
configIdleDetection.readEntry(QString::fromLatin1("peri
od"), 15);
+  _minDesktopActiveTimeValueV =
configIdleDetection.readEntry( QString::fromLatin1(
"minactivetime" ), 5 );
 
   KConfigGroup configSaving = KGlobal::config()->group(
QString::fromLatin1("Saving") );
   _iCalFileV = configSaving.readPathEntry
 -400,9
+412,10 
 void Preferences::save()
 {
   kDebug(5970) << "Entering
Preferences::save" << endl;
-  KConfigGroup configIdleDetection =
KGlobal::config()->group( QString("Idle
detection") );
-  configIdleDetection.writeEntry(
QString("enabled"), _doIdleDetectionV);
-  configIdleDetection.writeEntry(
QString("period"), _idleDetectValueV);
+  KConfigGroup configIdleDetection =
KGlobal::config()->group( QString( "Idle
detection" ) );
+  configIdleDetection.writeEntry( QString(
"enabled" ), _doIdleDetectionV );
+  configIdleDetection.writeEntry( QString(
"period" ), _idleDetectValueV );
+  configIdleDetection.writeEntry( QString(
"minactivetime" ), _minDesktopActiveTimeValueV );
   configIdleDetection.sync();
 
   KConfigGroup configSaving = KGlobal::config()->group(
QString("Saving") );
--- trunk/KDE/kdepim/ktimetracker/preferences.h
#691267:691268
 -45,6
+45,7 
     // Retrive information about settings
     bool detectIdleness() const;
     int idlenessTimeout() const;
+    int minimumDesktopActiveTime() const;
     QString iCalFile() const;
     QString activeCalendarFile() const;
     bool autoSave() const;
 -102,15
+103,15 
               *_displayTotalTimeW, *_displayTotalSessionW,
 	      *_decimalFormatW, *_displayPerCentCompleteW;
     QCheckBox *_loggingW;
-    QLabel    *_idleDetectLabelW, *_displayColumnsLabelW;
-    QSpinBox  *_idleDetectValueW, *_autoSaveValueW;
+    QLabel    *_idleDetectLabelW, *_displayColumnsLabelW,
*_minDesktopActiveTimeLabelW;
+    QSpinBox  *_idleDetectValueW, *_autoSaveValueW,
*_minDesktopActiveTimeValueW;
     KUrlRequester *_iCalFileW ;
 
     // Values
     bool _doIdleDetectionV, _doAutoSaveV, _promptDeleteV,
_loggingV, _uniTaskingV, _trayIconV;
     bool _displayColumnV[5];
     bool _decimalFormatV;
-    int  _idleDetectValueV, _autoSaveValueV;
+    int  _idleDetectValueV, _autoSaveValueV,
_minDesktopActiveTimeValueV;
     QString _iCalFileV;
 
     /** real name of the user, used during ICAL saving */
_______________________________________________
kde-docbook mailing list
kde-docbookkde.org
htt
ps://mail.kde.org/mailman/listinfo/kde-docbook

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )