00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "freebusyurldialog.h"
00026
00027 #include <libkcal/attendee.h>
00028 #include <libkcal/freebusyurlstore.h>
00029
00030 #include <klineedit.h>
00031 #include <klocale.h>
00032 #include <kdebug.h>
00033 #include <kstandarddirs.h>
00034
00035 #include <tqlayout.h>
00036 #include <tqlabel.h>
00037
00038 FreeBusyUrlDialog::FreeBusyUrlDialog( KCal::Attendee *attendee, TQWidget *parent,
00039 const char *name )
00040 : KDialogBase( Plain, i18n("Edit Free/Busy Location"), Ok|Cancel, Ok, parent,
00041 name, true, false )
00042 {
00043 TQFrame *topFrame = plainPage();
00044
00045 TQBoxLayout *topLayout = new TQVBoxLayout( topFrame, 0, spacingHint() );
00046
00047 mWidget = new FreeBusyUrlWidget( attendee, topFrame );
00048 topLayout->addWidget( mWidget );
00049
00050 mWidget->loadConfig();
00051 }
00052
00053 void FreeBusyUrlDialog::slotOk()
00054 {
00055 mWidget->saveConfig();
00056 accept();
00057 }
00058
00059
00060 FreeBusyUrlWidget::FreeBusyUrlWidget( KCal::Attendee *attendee, TQWidget *parent,
00061 const char *name )
00062 : TQWidget( parent, name ), mAttendee( attendee )
00063 {
00064 TQBoxLayout *topLayout = new TQVBoxLayout( this );
00065 topLayout->setSpacing( KDialog::spacingHint() );
00066
00067 TQLabel *label = new TQLabel(
00068 i18n("Location of Free/Busy information for %1 <%2>:")
00069 .arg( mAttendee->name() ).arg( mAttendee->email() ), this );
00070 topLayout->addWidget( label );
00071
00072 mUrlEdit = new KLineEdit( this );
00073 topLayout->addWidget( mUrlEdit );
00074 }
00075
00076 FreeBusyUrlWidget::~FreeBusyUrlWidget()
00077 {
00078 }
00079
00080 void FreeBusyUrlWidget::loadConfig()
00081 {
00082 kdDebug(5850) << "FreeBusyUrlWidget::loadConfig()" << endl;
00083
00084 TQString url = KCal::FreeBusyUrlStore::self()->readUrl( mAttendee->email() );
00085
00086 mUrlEdit->setText( url );
00087 }
00088
00089 void FreeBusyUrlWidget::saveConfig()
00090 {
00091 kdDebug(5850) << "FreeBusyUrlWidget::saveConfig()" << endl;
00092
00093 TQString url = mUrlEdit->text();
00094
00095 KCal::FreeBusyUrlStore::self()->writeUrl( mAttendee->email(), url );
00096
00097 KCal::FreeBusyUrlStore::self()->sync();
00098 }
00099
00100 #include "freebusyurldialog.moc"