libkcal Library API Documentation

resourcekabcconfig.cpp

00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #include <typeinfo> 00023 00024 #include <qlayout.h> 00025 00026 #include <klocale.h> 00027 #include <kdebug.h> 00028 00029 #include "resourcekabc.h" 00030 #include "resourcekabcconfig.h" 00031 00032 using namespace KCal; 00033 00034 ResourceKABCConfig::ResourceKABCConfig( QWidget* parent, const char* name ) 00035 : KRES::ConfigWidget( parent, name ) 00036 { 00037 QGridLayout *topLayout = new QGridLayout(this, 2, 1); 00038 00039 mAlarm = new QCheckBox(i18n("Set alarm"), this); 00040 topLayout->addWidget(mAlarm, 0, 0); 00041 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 00042 topLayout->addLayout(alarmLayout, 1, 0); 00043 00044 mALabel = new QLabel(i18n("Alarm before (in days):"), this); 00045 alarmLayout->addWidget(mALabel); 00046 mAlarmTimeEdit = new KRestrictedLine(this, "alarmTimeEdit", "1234567890"); 00047 mAlarmTimeEdit->setText("0"); 00048 alarmLayout->addWidget(mAlarmTimeEdit); 00049 00050 mAlarmTimeEdit->setDisabled(true); 00051 mALabel->setDisabled(true); 00052 00053 connect(mAlarm, SIGNAL(clicked()), SLOT(alarmClicked())); 00054 00055 setReadOnly( true ); 00056 } 00057 00058 void ResourceKABCConfig::loadSettings( KRES::Resource *resource ) 00059 { 00060 ResourceKABC *res = static_cast<ResourceKABC *>( resource ); 00061 if ( res ) { 00062 mAlarm->setChecked( res->alarm() ); 00063 QString days; 00064 mAlarmTimeEdit->setText( days.setNum(res->alarmDays()) ); 00065 00066 mAlarmTimeEdit->setEnabled( res->alarm() ); 00067 mALabel->setEnabled( res->alarm() ); 00068 } else { 00069 kdDebug(5700) << "ERROR: ResourceKABCConfig::loadSettings(): no ResourceKABC, cast failed" << endl; 00070 } 00071 } 00072 00073 void ResourceKABCConfig::saveSettings( KRES::Resource *resource ) 00074 { 00075 ResourceKABC *res = static_cast<ResourceKABC *>( resource ); 00076 if ( res ) { 00077 res->setAlarm( mAlarm->isChecked() ); 00078 res->setAlarmDays( mAlarmTimeEdit->text().toInt() ); 00079 setReadOnly( true ); 00080 } else { 00081 kdDebug(5700) << "ERROR: ResourceKABCConfig::saveSettings(): no ResourceKABC, cast failed" << endl; 00082 } 00083 } 00084 00085 void ResourceKABCConfig::alarmClicked() 00086 { 00087 mAlarmTimeEdit->setDisabled(!mAlarm->isChecked()); 00088 mALabel->setDisabled(!mAlarm->isChecked()); 00089 } 00090 00091 #include "resourcekabcconfig.moc"
KDE Logo
This file is part of the documentation for libkcal Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:49:12 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003