25 #include "freebusyurldialog.h"
27 #include <libkcal/attendee.h>
28 #include <libkcal/freebusyurlstore.h>
30 #include <klineedit.h>
31 #include <tdelocale.h>
33 #include <kstandarddirs.h>
38 FreeBusyUrlDialog::FreeBusyUrlDialog(
KCal::Attendee *attendee, TQWidget *parent,
40 : KDialogBase( Plain, i18n(
"Edit Free/Busy Location"), Ok|Cancel, Ok, parent,
43 TQFrame *topFrame = plainPage();
45 TQBoxLayout *topLayout =
new TQVBoxLayout( topFrame, 0, spacingHint() );
47 mWidget =
new FreeBusyUrlWidget( attendee, topFrame );
48 topLayout->addWidget( mWidget );
50 mWidget->loadConfig();
53 void FreeBusyUrlDialog::slotOk()
55 mWidget->saveConfig();
60 FreeBusyUrlWidget::FreeBusyUrlWidget(
KCal::Attendee *attendee, TQWidget *parent,
62 : TQWidget( parent, name ), mAttendee( attendee )
64 TQBoxLayout *topLayout =
new TQVBoxLayout(
this );
65 topLayout->setSpacing( KDialog::spacingHint() );
67 TQLabel *label =
new TQLabel(
68 i18n(
"Location of Free/Busy information for %1 <%2>:")
69 .arg( mAttendee->name() ).arg( mAttendee->email() ),
this );
70 topLayout->addWidget( label );
72 mUrlEdit =
new KLineEdit(
this );
73 topLayout->addWidget( mUrlEdit );
76 FreeBusyUrlWidget::~FreeBusyUrlWidget()
80 void FreeBusyUrlWidget::loadConfig()
82 kdDebug(5850) <<
"FreeBusyUrlWidget::loadConfig()" << endl;
84 TQString url = KCal::FreeBusyUrlStore::self()->readUrl( mAttendee->email() );
86 mUrlEdit->setText( url );
89 void FreeBusyUrlWidget::saveConfig()
91 kdDebug(5850) <<
"FreeBusyUrlWidget::saveConfig()" << endl;
93 TQString url = mUrlEdit->text();
95 KCal::FreeBusyUrlStore::self()->writeUrl( mAttendee->email(), url );
97 KCal::FreeBusyUrlStore::self()->sync();
100 #include "freebusyurldialog.moc"