korganizer Library API Documentation

freebusyurldialog.cpp

00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program 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 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of Qt, and distribute the resulting executable, 00022 without including the source code for Qt in the source distribution. 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 <qlayout.h> 00036 #include <qlabel.h> 00037 00038 FreeBusyUrlDialog::FreeBusyUrlDialog( KCal::Attendee *attendee, QWidget *parent, 00039 const char *name ) 00040 : KDialogBase( Plain, i18n("Edit Free/Busy Location"), Ok|Cancel, Ok, parent, 00041 name, true, false ) 00042 { 00043 QFrame *topFrame = plainPage(); 00044 00045 QBoxLayout *topLayout = new QVBoxLayout( 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, QWidget *parent, 00061 const char *name ) 00062 : QWidget( parent, name ), mAttendee( attendee ) 00063 { 00064 QBoxLayout *topLayout = new QVBoxLayout( this ); 00065 topLayout->setSpacing( KDialog::spacingHint() ); 00066 00067 QLabel *label = new QLabel( 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() << "FreeBusyUrlWidget::loadConfig()" << endl; 00083 00084 QString url = KCal::FreeBusyUrlStore::self()->readUrl( mAttendee->email() ); 00085 00086 mUrlEdit->setText( url ); 00087 } 00088 00089 void FreeBusyUrlWidget::saveConfig() 00090 { 00091 kdDebug() << "FreeBusyUrlWidget::saveConfig()" << endl; 00092 00093 QString url = mUrlEdit->text(); 00094 00095 KCal::FreeBusyUrlStore::self()->writeUrl( mAttendee->email(), url ); 00096 00097 KCal::FreeBusyUrlStore::self()->sync(); 00098 } 00099 00100 #include "freebusyurldialog.moc"
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:56 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003