korganizer
freebusyurldialog.cpp
Go to the documentation of this file.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 <kcal/attendee.h>
00028 #include <kcal/freebusyurlstore.h>
00029
00030 #include <klineedit.h>
00031 #include <klocale.h>
00032 #include <kdebug.h>
00033 #include <kstandarddirs.h>
00034
00035 #include <QLayout>
00036 #include <QLabel>
00037 #include <QVBoxLayout>
00038 #include <QFrame>
00039 #include <QBoxLayout>
00040
00041 FreeBusyUrlDialog::FreeBusyUrlDialog( KCal::Attendee *attendee, QWidget *parent )
00042 : KDialog( parent )
00043 {
00044 QFrame *topFrame = new QFrame( this );
00045 setMainWidget( topFrame );
00046 setModal( true );
00047 setCaption( i18n( "Edit Free/Busy Location" ) );
00048 setButtons( Ok|Cancel );
00049 setDefaultButton( Ok );
00050
00051 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
00052 topLayout->setSpacing( spacingHint() );
00053 topLayout->setMargin( 0 );
00054
00055 mWidget = new FreeBusyUrlWidget( attendee, topFrame );
00056 topLayout->addWidget( mWidget );
00057
00058 mWidget->loadConfig();
00059 connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()) );
00060 }
00061
00062 void FreeBusyUrlDialog::slotOk()
00063 {
00064 mWidget->saveConfig();
00065 accept();
00066 }
00067
00068 FreeBusyUrlWidget::FreeBusyUrlWidget( KCal::Attendee *attendee, QWidget *parent )
00069 : QWidget( parent ), mAttendee( attendee )
00070 {
00071 QBoxLayout *topLayout = new QVBoxLayout( this );
00072 topLayout->setSpacing( KDialog::spacingHint() );
00073
00074 QLabel *label =
00075 new QLabel( i18n( "Location of Free/Busy information for %1 <placeholder>%2</placeholder>:",
00076 mAttendee->name(), mAttendee->email() ), this );
00077 topLayout->addWidget( label );
00078
00079 mUrlEdit = new KLineEdit( this );
00080 topLayout->addWidget( mUrlEdit );
00081 }
00082
00083 FreeBusyUrlWidget::~FreeBusyUrlWidget()
00084 {
00085 }
00086
00087 void FreeBusyUrlWidget::loadConfig()
00088 {
00089 kDebug();
00090
00091 QString url = KCal::FreeBusyUrlStore::self()->readUrl( mAttendee->email() );
00092 mUrlEdit->setText( url );
00093 }
00094
00095 void FreeBusyUrlWidget::saveConfig()
00096 {
00097 kDebug();
00098
00099 QString url = mUrlEdit->text();
00100 KCal::FreeBusyUrlStore::self()->writeUrl( mAttendee->email(), url );
00101 KCal::FreeBusyUrlStore::self()->sync();
00102 }
00103
00104 #include "freebusyurldialog.moc"