21 #include "resourcecached.h"
24 #include <klocalizedstring.h>
26 #include "resourcecachedconfig.h"
29 #include <QRadioButton>
32 #include <QVBoxLayout>
35 #include <QButtonGroup>
42 class ResourceCachedConfigPrivate
45 ResourceCachedConfigPrivate()
53 class KCal::ResourceCachedReloadConfig::Private
54 :
public ResourceCachedConfigPrivate
58 class KCal::ResourceCachedSaveConfig::Private
59 :
public ResourceCachedConfigPrivate
64 ResourceCachedReloadConfig::ResourceCachedReloadConfig(
QWidget *parent )
69 QGroupBox *groupBox =
new QGroupBox( i18nc(
"@title:group",
"Automatic Reload" ),
this );
73 i18nc(
"@option:radio never reload the cache",
"Never" ), groupBox );
76 i18nc(
"@option:radio reload the cache on startup",
"On startup" ), groupBox );
79 i18nc(
"@option:radio reload the cache at regular intervals",
80 "Regular interval" ), groupBox );
82 d->mGroup->addButton( noAutomaticReload, 0 );
83 d->mGroup->addButton( automaticReloadOnStartup, 1 );
84 d->mGroup->addButton( intervalRadio, 2 );
86 connect( intervalRadio, SIGNAL(toggled(
bool)),
87 SLOT(slotIntervalToggled(
bool)) );
89 KHBox *intervalBox =
new KHBox;
90 new QLabel( i18nc(
"@label:spinbox",
"Interval in minutes:" ), intervalBox );
91 d->mIntervalSpin =
new QSpinBox( intervalBox );
92 d->mIntervalSpin->setRange( 1, 900 );
93 d->mIntervalSpin->setEnabled(
false );
97 vbox->
addWidget(automaticReloadOnStartup);
104 ResourceCachedReloadConfig::~ResourceCachedReloadConfig()
109 void ResourceCachedReloadConfig::loadSettings(
ResourceCached *resource )
111 d->mGroup->button( resource->
reloadPolicy() )->setChecked(
true );
115 void ResourceCachedReloadConfig::saveSettings(
ResourceCached *resource )
121 void ResourceCachedReloadConfig::slotIntervalToggled(
bool checked )
124 d->mIntervalSpin->setEnabled(
true );
126 d->mIntervalSpin->setEnabled(
false );
130 ResourceCachedSaveConfig::ResourceCachedSaveConfig(
QWidget *parent )
135 QGroupBox *groupBox =
new QGroupBox( i18nc(
"@title:group",
"Automatic Save" ),
this );
140 i18nc(
"@option:radio never save the cache automatically",
"Never" ), groupBox );
143 i18nc(
"@option:radio save the cache on exit",
"On exit" ), groupBox );
147 i18nc(
"@option:radio save the cache at regular intervals",
"Regular interval" ), groupBox );
150 d->mGroup->addButton( never, 0 );
151 d->mGroup->addButton( onExit, 1 );
152 d->mGroup->addButton( intervalRadio, 2 );
154 connect( intervalRadio, SIGNAL(toggled(
bool)),
155 SLOT(slotIntervalToggled(
bool)) );
157 KHBox *intervalBox =
new KHBox;
158 new QLabel( i18nc(
"@label:spinbox",
"Interval in minutes:" ), intervalBox );
159 d->mIntervalSpin =
new QSpinBox( intervalBox );
160 d->mIntervalSpin->setRange( 1, 900 );
161 d->mIntervalSpin->setEnabled(
false );
165 i18nc(
"@option:radio save the cache after some delay",
166 "Delayed after changes" ), groupBox );
169 i18nc(
"@option:radio save the cache after every modification",
170 "On every change" ), groupBox );
171 d->mGroup->addButton( delay, 3 );
172 d->mGroup->addButton( every, 4 );
186 ResourceCachedSaveConfig::~ResourceCachedSaveConfig()
191 void ResourceCachedSaveConfig::loadSettings(
ResourceCached *resource )
193 d->mGroup->button( resource->
savePolicy() )->setChecked(
true );
197 void ResourceCachedSaveConfig::saveSettings(
ResourceCached *resource )
203 void ResourceCachedSaveConfig::slotIntervalToggled(
bool checked )
206 d->mIntervalSpin->setEnabled(
true );
208 d->mIntervalSpin->setEnabled(
false );
int savePolicy() const
Return save policy.
Configuration widget for save policy.
void setSavePolicy(int policy)
Set save policy.
Configuration widget for reload policy.
void setSaveInterval(int minutes)
Set save interval in minutes which is used when save policy is SaveInterval.
void setReloadInterval(int minutes)
Set reload interval in minutes which is used when reload policy is ReloadInterval.
int saveInterval() const
Return save interval in minutes.
int reloadInterval() const
Return reload interval in minutes.
void addStretch(int stretch)
This class provides a calendar resource using a local CalendarLocal object to cache the calendar data...
int reloadPolicy() const
Return reload policy.
void setReloadPolicy(int policy)
Set reload policy.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)