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 <qlayout.h>
00026 #include <qhgroupbox.h>
00027 #include <qvgroupbox.h>
00028 #include <qvbuttongroup.h>
00029 #include <qradiobutton.h>
00030 #include <qcheckbox.h>
00031 #include <qlineedit.h>
00032 #include <qhbox.h>
00033 #include <qvbox.h>
00034 #include <qpushbutton.h>
00035 #include <qfiledialog.h>
00036 #include <qtextstream.h>
00037 #include <qlabel.h>
00038
00039 #include <klocale.h>
00040 #include <kdebug.h>
00041 #include <kfiledialog.h>
00042 #include <klineedit.h>
00043 #include <kurl.h>
00044 #include <kio/job.h>
00045 #include <kstandarddirs.h>
00046 #include <kconfig.h>
00047 #include "koglobals.h"
00048 #include <kurlrequester.h>
00049 #include <kio/netaccess.h>
00050 #include <knotifyclient.h>
00051 #include <ktempfile.h>
00052 #include <kmessagebox.h>
00053
00054 #include <libkcal/calendar.h>
00055 #include <libkcal/htmlexportsettings.h>
00056
00057 #include <libkdepim/kdateedit.h>
00058 #include <libkdepim/kdateedit.h>
00059
00060 #include "koprefs.h"
00061 #include "kocore.h"
00062
00063 #include "exportwebdialog.h"
00064 #include "exportwebdialog.moc"
00065
00066
00067
00068
00069
00070
00071 ExportWebDialog::ExportWebDialog( HTMLExportSettings *settings, QWidget *parent,
00072 const char *name)
00073 : KDialogBase( Tabbed,i18n("Export Calendar as Web Page"),Help|Default|User1|Cancel, User1, parent, name, false, false, i18n("Export") ),
00074 KPrefsWidManager( settings ), mSettings( settings )
00075 {
00076 setupGeneralPage();
00077 setupEventPage();
00078 setupTodoPage();
00079
00080
00081
00082
00083
00084 connect( this, SIGNAL( user1Clicked() ), SLOT( slotOk() ) );
00085 connect( this, SIGNAL( cancelClicked() ), SLOT( reject() ) );
00086
00087 readConfig();
00088 updateState();
00089 }
00090
00091 ExportWebDialog::~ExportWebDialog()
00092 {
00093 }
00094
00095 void ExportWebDialog::setDefaults()
00096 {
00097 setWidDefaults();
00098 }
00099
00100 void ExportWebDialog::readConfig()
00101 {
00102 readWidConfig();
00103 usrReadConfig();
00104 }
00105
00106 void ExportWebDialog::writeConfig()
00107 {
00108 writeWidConfig();
00109 usrWriteConfig();
00110 readConfig();
00111 }
00112
00113 void ExportWebDialog::slotApply()
00114 {
00115 writeConfig();
00116 emit configChanged();
00117 }
00118
00119 void ExportWebDialog::slotOk()
00120 {
00121 slotApply();
00122 emit exportHTML( mSettings );
00123 accept();
00124 }
00125
00126 void ExportWebDialog::slotDefault()
00127 {
00128 kdDebug(5850) << "KPrefsDialog::slotDefault()" << endl;
00129
00130 if (KMessageBox::warningContinueCancel(this,
00131 i18n("You are about to set all preferences to default values. All "
00132 "custom modifications will be lost."),i18n("Setting Default Preferences"),
00133 i18n("Reset to Defaults"))
00134 == KMessageBox::Continue) setDefaults();
00135 }
00136
00137
00138 void ExportWebDialog::setupGeneralPage()
00139 {
00140 mGeneralPage = addPage( i18n("General") );
00141 QVBoxLayout *topLayout = new QVBoxLayout(mGeneralPage, 10);
00142
00143 mDateRangeBox = new QHGroupBox( i18n("Date Range"), mGeneralPage );
00144 topLayout->addWidget( mDateRangeBox );
00145 addWidDate( mSettings->dateStartItem(), mDateRangeBox );
00146 addWidDate( mSettings->dateEndItem(), mDateRangeBox );
00147
00148 QButtonGroup *typeGroup = new QVButtonGroup( i18n("View Type"), mGeneralPage );
00149 topLayout->addWidget( typeGroup );
00150
00151 mMonthViewCheckBox = addWidBool( mSettings->monthViewItem(), typeGroup )->checkBox();
00152 connect( mMonthViewCheckBox, SIGNAL(toggled(bool)), SLOT(updateState()) );
00153 mEventListCheckBox = addWidBool( mSettings->eventViewItem(), typeGroup )->checkBox();
00154 connect( mEventListCheckBox, SIGNAL(toggled(bool)), SLOT(updateState()) );
00155 addWidBool( mSettings->todoViewItem(), typeGroup );
00156
00157
00158 addWidBool( mSettings->excludePrivateItem(), typeGroup );
00159 addWidBool( mSettings->excludeConfidentialItem(), typeGroup );
00160
00161 QGroupBox *destGroup = new QVGroupBox(i18n("Destination"), mGeneralPage );
00162 topLayout->addWidget(destGroup);
00163 KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
00164 destGroup, "text/html", KFile::File );
00165 connect( pathWid->urlRequester(), SIGNAL( textChanged( const QString & ) ),
00166 SLOT( slotTextChanged( const QString & ) ) );
00167
00168 topLayout->addStretch( 1 );
00169 }
00170
00171 void ExportWebDialog::slotTextChanged( const QString & _text)
00172 {
00173 enableButton( User1, !_text.isEmpty() );
00174 }
00175
00176 void ExportWebDialog::setupTodoPage()
00177 {
00178 mTodoPage = addPage(i18n("To-dos"));
00179 QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage, 10 );
00180
00181 QHBox *hbox = new QHBox( mTodoPage );
00182 topLayout->addWidget( hbox );
00183 addWidString( mSettings->todoListTitleItem(), hbox );
00184
00185 QVBox *vbox = new QVBox( mTodoPage );
00186 topLayout->addWidget( vbox );
00187 addWidBool( mSettings->taskDueDateItem(), vbox );
00188 addWidBool( mSettings->taskLocationItem(), vbox );
00189 addWidBool( mSettings->taskCategoriesItem(), vbox );
00190 addWidBool( mSettings->taskAttendeesItem(), vbox );
00191
00192
00193
00194 topLayout->addStretch(1);
00195 }
00196
00197 void ExportWebDialog::setupEventPage()
00198 {
00199 mEventPage = addPage(i18n("Events"));
00200 QVBoxLayout *topLayout = new QVBoxLayout( mEventPage, 10 );
00201
00202 QHBox *hbox = new QHBox( mEventPage );
00203 topLayout->addWidget( hbox );
00204 addWidString( mSettings->eventTitleItem(), hbox );
00205
00206 QVBox *vbox = new QVBox( mEventPage );
00207 topLayout->addWidget( vbox );
00208 addWidBool( mSettings->eventLocationItem(), vbox );
00209 addWidBool( mSettings->eventCategoriesItem(), vbox );
00210 addWidBool( mSettings->eventAttendeesItem(), vbox );
00211
00212
00213
00214 topLayout->addStretch(1);
00215 }
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 void ExportWebDialog::updateState()
00263 {
00264 const bool exportEvents = mMonthViewCheckBox->isChecked() || mEventListCheckBox->isChecked();
00265 mDateRangeBox->setEnabled( exportEvents );
00266 mEventPage->setEnabled( exportEvents );
00267 }
00268