/*
    This file is part of KitchenSync.

    Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include "localkonnectorconfig.h"

#include "localkonnector.h"

#include <kconfig.h>
#include <klocale.h>

#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>

using namespace KSync;

LocalKonnectorConfig::LocalKonnectorConfig( QWidget *parent )
  : KRES::ConfigWidget( parent, 0 )
{
  QBoxLayout *topLayout = new QVBoxLayout( this );

  topLayout->addWidget( new QLabel( i18n("Calendar file:"), this ) );

  mCalendarFile = new KURLRequester( this );
  topLayout->addWidget( mCalendarFile );

  topLayout->addWidget( new QLabel( i18n("Address book file:"), this ) );
  
  mAddressBookFile = new KURLRequester( this );
  topLayout->addWidget( mAddressBookFile );
}

LocalKonnectorConfig::~LocalKonnectorConfig()
{
}

void LocalKonnectorConfig::loadSettings( KRES::Resource *r )
{
  LocalKonnector *konnector = dynamic_cast<LocalKonnector *>( r );
  if ( konnector ) {
    mCalendarFile->setURL( konnector->calendarFile() );
    mAddressBookFile->setURL( konnector->addressBookFile() );
  }
}

void LocalKonnectorConfig::saveSettings( KRES::Resource *r )
{
  LocalKonnector *konnector = dynamic_cast<LocalKonnector *>( r );
  if ( konnector ) {
    konnector->setCalendarFile( mCalendarFile->url() );
    konnector->setAddressBookFile( mAddressBookFile->url() );
  }
}

#include "localkonnectorconfig.moc"
