26 #include <tqhgroupbox.h>
27 #include <tqvgroupbox.h>
28 #include <tqvbuttongroup.h>
29 #include <tqradiobutton.h>
30 #include <tqcheckbox.h>
31 #include <tqlineedit.h>
34 #include <tqpushbutton.h>
35 #include <tqfiledialog.h>
36 #include <tqtextstream.h>
39 #include <tdelocale.h>
41 #include <tdefiledialog.h>
42 #include <klineedit.h>
44 #include <tdeio/job.h>
45 #include <kstandarddirs.h>
46 #include <tdeconfig.h>
47 #include "koglobals.h"
48 #include <kurlrequester.h>
49 #include <tdeio/netaccess.h>
50 #include <knotifyclient.h>
51 #include <tdetempfile.h>
52 #include <tdemessagebox.h>
55 #include <libkcal/htmlexportsettings.h>
57 #include <libtdepim/kdateedit.h>
58 #include <libtdepim/kdateedit.h>
63 #include "exportwebdialog.h"
64 #include "exportwebdialog.moc"
71 ExportWebDialog::ExportWebDialog( HTMLExportSettings *settings, TQWidget *parent,
73 : KDialogBase( Tabbed,i18n(
"Export Calendar as Web Page"),Help|Default|User1|Cancel, User1, parent, name, false, false, i18n(
"Export") ),
74 KPrefsWidManager( settings ), mSettings( settings )
84 connect(
this, TQ_SIGNAL( user1Clicked() ), TQ_SLOT( slotOk() ) );
85 connect(
this, TQ_SIGNAL( cancelClicked() ), TQ_SLOT( reject() ) );
91 ExportWebDialog::~ExportWebDialog()
95 void ExportWebDialog::setDefaults()
100 void ExportWebDialog::readConfig()
106 void ExportWebDialog::writeConfig()
113 void ExportWebDialog::slotApply()
116 emit configChanged();
119 void ExportWebDialog::slotOk()
122 emit exportHTML( mSettings );
126 void ExportWebDialog::slotDefault()
128 kdDebug(5850) <<
"KPrefsDialog::slotDefault()" << endl;
130 if (KMessageBox::warningContinueCancel(
this,
131 i18n(
"You are about to set all preferences to default values. All "
132 "custom modifications will be lost."),i18n(
"Setting Default Preferences"),
133 i18n(
"Reset to Defaults"))
134 == KMessageBox::Continue) setDefaults();
138 void ExportWebDialog::setupGeneralPage()
140 mGeneralPage = addPage( i18n(
"General") );
141 TQVBoxLayout *topLayout =
new TQVBoxLayout(mGeneralPage, 10);
143 mDateRangeBox =
new TQHGroupBox( i18n(
"Date Range"), mGeneralPage );
144 topLayout->addWidget( mDateRangeBox );
145 addWidDate( mSettings->dateStartItem(), mDateRangeBox );
146 addWidDate( mSettings->dateEndItem(), mDateRangeBox );
148 TQButtonGroup *typeGroup =
new TQVButtonGroup( i18n(
"View Type"), mGeneralPage );
149 topLayout->addWidget( typeGroup );
151 mMonthViewCheckBox = addWidBool( mSettings->monthViewItem(), typeGroup )->checkBox();
152 connect( mMonthViewCheckBox, TQ_SIGNAL(toggled(
bool)), TQ_SLOT(updateState()) );
153 mEventListCheckBox = addWidBool( mSettings->eventViewItem(), typeGroup )->checkBox();
154 connect( mEventListCheckBox, TQ_SIGNAL(toggled(
bool)), TQ_SLOT(updateState()) );
155 addWidBool( mSettings->todoViewItem(), typeGroup );
158 addWidBool( mSettings->excludePrivateItem(), typeGroup );
159 addWidBool( mSettings->excludeConfidentialItem(), typeGroup );
161 TQGroupBox *destGroup =
new TQVGroupBox(i18n(
"Destination"), mGeneralPage );
162 topLayout->addWidget(destGroup);
163 KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
164 destGroup,
"text/html", KFile::File );
165 connect( pathWid->urlRequester(), TQ_SIGNAL( textChanged(
const TQString & ) ),
166 TQ_SLOT( slotTextChanged(
const TQString & ) ) );
168 topLayout->addStretch( 1 );
171 void ExportWebDialog::slotTextChanged(
const TQString & _text)
173 enableButton( User1, !_text.isEmpty() );
176 void ExportWebDialog::setupTodoPage()
178 mTodoPage = addPage(i18n(
"To-dos"));
179 TQVBoxLayout *topLayout =
new TQVBoxLayout( mTodoPage, 10 );
181 TQHBox *hbox =
new TQHBox( mTodoPage );
182 topLayout->addWidget( hbox );
183 addWidString( mSettings->todoListTitleItem(), hbox );
185 TQVBox *vbox =
new TQVBox( mTodoPage );
186 topLayout->addWidget( vbox );
187 addWidBool( mSettings->taskDueDateItem(), vbox );
188 addWidBool( mSettings->taskLocationItem(), vbox );
189 addWidBool( mSettings->taskCategoriesItem(), vbox );
190 addWidBool( mSettings->taskAttendeesItem(), vbox );
194 topLayout->addStretch(1);
197 void ExportWebDialog::setupEventPage()
199 mEventPage = addPage(i18n(
"Events"));
200 TQVBoxLayout *topLayout =
new TQVBoxLayout( mEventPage, 10 );
202 TQHBox *hbox =
new TQHBox( mEventPage );
203 topLayout->addWidget( hbox );
204 addWidString( mSettings->eventTitleItem(), hbox );
206 TQVBox *vbox =
new TQVBox( mEventPage );
207 topLayout->addWidget( vbox );
208 addWidBool( mSettings->eventLocationItem(), vbox );
209 addWidBool( mSettings->eventCategoriesItem(), vbox );
210 addWidBool( mSettings->eventAttendeesItem(), vbox );
214 topLayout->addStretch(1);
262 void ExportWebDialog::updateState()
264 const bool exportEvents = mMonthViewCheckBox->isChecked() || mEventListCheckBox->isChecked();
265 mDateRangeBox->setEnabled( exportEvents );
266 mEventPage->setEnabled( exportEvents );