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 }
00089
00090 ExportWebDialog::~ExportWebDialog()
00091 {
00092 }
00093
00094 void ExportWebDialog::setDefaults()
00095 {
00096 setWidDefaults();
00097 }
00098
00099 void ExportWebDialog::readConfig()
00100 {
00101 readWidConfig();
00102 usrReadConfig();
00103 }
00104
00105 void ExportWebDialog::writeConfig()
00106 {
00107 writeWidConfig();
00108 usrWriteConfig();
00109 readConfig();
00110 }
00111
00112 void ExportWebDialog::slotApply()
00113 {
00114 writeConfig();
00115 emit configChanged();
00116 }
00117
00118 void ExportWebDialog::slotOk()
00119 {
00120 slotApply();
00121 emit exportHTML( mSettings );
00122 accept();
00123 }
00124
00125 void ExportWebDialog::slotDefault()
00126 {
00127 kdDebug(5850) << "KPrefsDialog::slotDefault()" << endl;
00128
00129 if (KMessageBox::warningContinueCancel(this,
00130 i18n("You are about to set all preferences to default values. All "
00131 "custom modifications will be lost."),i18n("Setting Default Preferences"),
00132 i18n("Reset to Defaults"))
00133 == KMessageBox::Continue) setDefaults();
00134 }
00135
00136
00137 void ExportWebDialog::setupGeneralPage()
00138 {
00139 mGeneralPage = addPage( i18n("General") );
00140 QVBoxLayout *topLayout = new QVBoxLayout(mGeneralPage, 10);
00141
00142 QGroupBox *rangeGroup = new QHGroupBox( i18n("Date Range"), mGeneralPage );
00143 topLayout->addWidget( rangeGroup );
00144 addWidDate( mSettings->dateStartItem(), rangeGroup );
00145 addWidDate( mSettings->dateEndItem(), rangeGroup );
00146
00147 QButtonGroup *typeGroup = new QVButtonGroup( i18n("View Type"), mGeneralPage );
00148 topLayout->addWidget( typeGroup );
00149
00150 addWidBool( mSettings->monthViewItem(), typeGroup );
00151 addWidBool( mSettings->eventViewItem(), typeGroup );
00152 addWidBool( mSettings->todoViewItem(), typeGroup );
00153
00154
00155 addWidBool( mSettings->excludePrivateItem(), typeGroup );
00156 addWidBool( mSettings->excludeConfidentialItem(), typeGroup );
00157
00158 QGroupBox *destGroup = new QVGroupBox(i18n("Destination"), mGeneralPage );
00159 topLayout->addWidget(destGroup);
00160 KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
00161 destGroup, "text/html", KFile::File );
00162 connect( pathWid->urlRequester(), SIGNAL( textChanged( const QString & ) ),
00163 SLOT( slotTextChanged( const QString & ) ) );
00164
00165 topLayout->addStretch( 1 );
00166 }
00167
00168 void ExportWebDialog::slotTextChanged( const QString & _text)
00169 {
00170 enableButton( User1, !_text.isEmpty() );
00171 }
00172
00173 void ExportWebDialog::setupTodoPage()
00174 {
00175 mTodoPage = addPage(i18n("To-dos"));
00176 QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage, 10 );
00177
00178 QHBox *hbox = new QHBox( mTodoPage );
00179 topLayout->addWidget( hbox );
00180 addWidString( mSettings->todoListTitleItem(), hbox );
00181
00182 QVBox *vbox = new QVBox( mTodoPage );
00183 topLayout->addWidget( vbox );
00184 addWidBool( mSettings->taskDueDateItem(), vbox );
00185 addWidBool( mSettings->taskLocationItem(), vbox );
00186 addWidBool( mSettings->taskCategoriesItem(), vbox );
00187 addWidBool( mSettings->taskAttendeesItem(), vbox );
00188
00189
00190
00191 topLayout->addStretch(1);
00192 }
00193
00194 void ExportWebDialog::setupEventPage()
00195 {
00196 mEventPage = addPage(i18n("Events"));
00197 QVBoxLayout *topLayout = new QVBoxLayout( mEventPage, 10 );
00198
00199 QHBox *hbox = new QHBox( mEventPage );
00200 topLayout->addWidget( hbox );
00201 addWidString( mSettings->eventTitleItem(), hbox );
00202
00203 QVBox *vbox = new QVBox( mEventPage );
00204 topLayout->addWidget( vbox );
00205 addWidBool( mSettings->eventLocationItem(), vbox );
00206 addWidBool( mSettings->eventCategoriesItem(), vbox );
00207 addWidBool( mSettings->eventAttendeesItem(), vbox );
00208
00209
00210
00211 topLayout->addStretch(1);
00212 }
00213
00214
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