2
This file is part of kdepim.
4
Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5
Copyright (c) 2004 Till Adam <adam@kde.org>
6
Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include "kcal_resourcegroupwarebaseconfig.h"
25
#include "kcal_cachesettingsdlg.h"
26
#include "kcal_resourcegroupwarebase.h"
27
#include "kresources_groupwareprefs.h"
28
#include "folderconfig.h"
30
#include <kcal/resourcecachedconfig.h>
34
#include <klineedit.h>
36
#include <kpushbutton.h>
42
#include <QGridLayout>
47
ResourceGroupwareBaseConfig::ResourceGroupwareBaseConfig( QWidget* parent,
49
: KRES::ConfigWidget( parent)
54
QGridLayout *mainLayout = new QGridLayout( this );
55
mainLayout->setSpacing( KDialog::spacingHint() );
57
QLabel *label = new QLabel( i18n("URL:"), this );
58
mainLayout->addWidget( label, 1, 0 );
59
mUrl = new KLineEdit( this );
60
mainLayout->addWidget( mUrl, 1, 1 );
62
label = new QLabel( i18n("User:"), this );
63
mainLayout->addWidget( label, 2, 0 );
64
mUserEdit = new KLineEdit( this );
65
mainLayout->addWidget( mUserEdit, 2, 1 );
67
label = new QLabel( i18n("Password:"), this );
68
mainLayout->addWidget( label, 3, 0 );
69
mPasswordEdit = new KLineEdit( this );
70
mainLayout->addWidget( mPasswordEdit, 3, 1 );
71
mPasswordEdit->setEchoMode( KLineEdit::Password );
73
mFolderConfig = new KPIM::FolderConfig( this );
74
connect( mFolderConfig, SIGNAL( updateFoldersClicked() ),
75
SLOT( updateFolders() ) );
76
mainLayout->addWidget( mFolderConfig, 4, 0, 1, 2 );
78
KHBox *hBox = new KHBox( this );
79
mCacheSettingsButton = new KPushButton( i18n("Configure Cache Settings..."), hBox );
80
mainLayout->addWidget( hBox, 5, 0, 1, 2 );
81
connect( mCacheSettingsButton, SIGNAL( clicked() ),
82
SLOT( showCacheSettings() ) );
84
mCacheDialog = new CacheSettingsDialog( this );
87
void ResourceGroupwareBaseConfig::loadSettings( KRES::Resource *resource )
89
kDebug(7000) <<"KCal::ResourceGroupwareBaseConfig::loadSettings()";
91
ResourceGroupwareBase *res = static_cast<ResourceGroupwareBase *>( resource );
93
if ( !res->prefs() ) {
98
mUrl->setText( res->prefs()->url() );
99
mUserEdit->setText( res->prefs()->user() );
100
mPasswordEdit->setText( res->prefs()->password() );
101
if ( mCacheDialog ) mCacheDialog->loadSettings( res );
103
mFolderConfig->setFolderLister( res->folderLister() );
104
mFolderConfig->updateFolderList();
106
kError(5700) <<"KCalResourceGroupwareBaseConfig::loadSettings():"
107
"no KCalOpenGroupware, cast failed";
111
void ResourceGroupwareBaseConfig::saveSettings( KRES::Resource *resource )
113
ResourceGroupwareBase *res = static_cast<ResourceGroupwareBase*>( resource );
115
res->prefs()->setUrl( mUrl->text() );
116
res->prefs()->setUser( mUserEdit->text() );
117
res->prefs()->setPassword( mPasswordEdit->text() );
118
if ( mCacheDialog ) mCacheDialog->saveSettings( res );
119
mFolderConfig->saveSettings();
121
kError(5700) <<"KCalResourceGroupwareBaseConfig::saveSettings():"
122
"no KCalOpenGroupware, cast failed";
126
void ResourceGroupwareBaseConfig::updateFolders()
128
KUrl url = mUrl->text();
129
url.setUser( mUserEdit->text() );
130
url.setPass( mPasswordEdit->text() );
132
mFolderConfig->retrieveFolderList( url );
135
void ResourceGroupwareBaseConfig::showCacheSettings()
137
if ( mCacheDialog ) mCacheDialog->exec();
140
#include "kcal_resourcegroupwarebaseconfig.moc"