From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korganizer/exportwebdialog.cpp | 257 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 korganizer/exportwebdialog.cpp (limited to 'korganizer/exportwebdialog.cpp') diff --git a/korganizer/exportwebdialog.cpp b/korganizer/exportwebdialog.cpp new file mode 100644 index 000000000..e62b94c93 --- /dev/null +++ b/korganizer/exportwebdialog.cpp @@ -0,0 +1,257 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 Cornelius Schumacher + Copyright (c) 2004 Reinhold Kainhofer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "koglobals.h" +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "koprefs.h" +#include "kocore.h" + +#include "exportwebdialog.h" +#include "exportwebdialog.moc" + + +// FIXME: The basic structure of this dialog has been copied from KPrefsDialog, +// because we want custom buttons, a Tabbed dialog, and a different +// headline... Maybe we should try to achieve the same without code +// duplication. +ExportWebDialog::ExportWebDialog( HTMLExportSettings *settings, QWidget *parent, + const char *name) + : KDialogBase( Tabbed,i18n("Export Calendar as Web Page"),Help|Default|User1|Cancel, User1, parent, name, false, false, i18n("Export") ), + KPrefsWidManager( settings ), mSettings( settings ) +{ + setupGeneralPage(); + setupEventPage(); + setupTodoPage(); +// Disabled bacause the functionality is not yet implemented. +// setupJournalPage(); +// setupFreeBusyPage(); +// setupAdvancedPage(); + + connect( this, SIGNAL( user1Clicked() ), SLOT( slotOk() ) ); + connect( this, SIGNAL( cancelClicked() ), SLOT( reject() ) ); + + readConfig(); +} + +ExportWebDialog::~ExportWebDialog() +{ +} + +void ExportWebDialog::setDefaults() +{ + setWidDefaults(); +} + +void ExportWebDialog::readConfig() +{ + readWidConfig(); + usrReadConfig(); +} + +void ExportWebDialog::writeConfig() +{ + writeWidConfig(); + usrWriteConfig(); + readConfig(); +} + +void ExportWebDialog::slotApply() +{ + writeConfig(); + emit configChanged(); +} + +void ExportWebDialog::slotOk() +{ + slotApply(); + emit exportHTML( mSettings ); + accept(); +} + +void ExportWebDialog::slotDefault() +{ + kdDebug(5850) << "KPrefsDialog::slotDefault()" << endl; + + if (KMessageBox::warningContinueCancel(this, + i18n("You are about to set all preferences to default values. All " + "custom modifications will be lost."),i18n("Setting Default Preferences"), + i18n("Reset to Defaults")) + == KMessageBox::Continue) setDefaults(); +} + + +void ExportWebDialog::setupGeneralPage() +{ + mGeneralPage = addPage( i18n("General") ); + QVBoxLayout *topLayout = new QVBoxLayout(mGeneralPage, 10); + + QGroupBox *rangeGroup = new QHGroupBox( i18n("Date Range"), mGeneralPage ); + topLayout->addWidget( rangeGroup ); + addWidDate( mSettings->dateStartItem(), rangeGroup ); + addWidDate( mSettings->dateEndItem(), rangeGroup ); + + QButtonGroup *typeGroup = new QVButtonGroup( i18n("View Type"), mGeneralPage ); + topLayout->addWidget( typeGroup ); +// addWidBool( mSettings->weekViewItem(), typeGroup ); + addWidBool( mSettings->monthViewItem(), typeGroup ); + addWidBool( mSettings->eventViewItem(), typeGroup ); + addWidBool( mSettings->todoViewItem(), typeGroup ); +// addWidBool( mSettings->journalViewItem(), typeGroup ); +// addWidBool( mSettings->freeBusyViewItem(), typeGroup ); + addWidBool( mSettings->excludePrivateItem(), typeGroup ); + addWidBool( mSettings->excludeConfidentialItem(), typeGroup ); + + QGroupBox *destGroup = new QVGroupBox(i18n("Destination"), mGeneralPage ); + topLayout->addWidget(destGroup); + KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(), + destGroup, "text/html", KFile::File ); + connect( pathWid->urlRequester(), SIGNAL( textChanged( const QString & ) ), + SLOT( slotTextChanged( const QString & ) ) ); + + topLayout->addStretch( 1 ); +} + +void ExportWebDialog::slotTextChanged( const QString & _text) +{ + enableButton( User1, !_text.isEmpty() ); +} + +void ExportWebDialog::setupTodoPage() +{ + mTodoPage = addPage(i18n("To-dos")); + QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage, 10 ); + + QHBox *hbox = new QHBox( mTodoPage ); + topLayout->addWidget( hbox ); + addWidString( mSettings->todoListTitleItem(), hbox ); + + QVBox *vbox = new QVBox( mTodoPage ); + topLayout->addWidget( vbox ); + addWidBool( mSettings->taskDueDateItem(), vbox ); + addWidBool( mSettings->taskLocationItem(), vbox ); + addWidBool( mSettings->taskCategoriesItem(), vbox ); + addWidBool( mSettings->taskAttendeesItem(), vbox ); +// addWidBool( mSettings->taskExcludePrivateItem(), vbox ); +// addWidBool( mSettings->taskExcludeConfidentialItem(), vbox ); + + topLayout->addStretch(1); +} + +void ExportWebDialog::setupEventPage() +{ + mEventPage = addPage(i18n("Events")); + QVBoxLayout *topLayout = new QVBoxLayout( mEventPage, 10 ); + + QHBox *hbox = new QHBox( mEventPage ); + topLayout->addWidget( hbox ); + addWidString( mSettings->eventTitleItem(), hbox ); + + QVBox *vbox = new QVBox( mEventPage ); + topLayout->addWidget( vbox ); + addWidBool( mSettings->eventLocationItem(), vbox ); + addWidBool( mSettings->eventCategoriesItem(), vbox ); + addWidBool( mSettings->eventAttendeesItem(), vbox ); +// addWidBool( mSettings->eventExcludePrivateItem(), vbox ); +// addWidBool( mSettings->eventExcludeConfidentialItem(), vbox ); + + topLayout->addStretch(1); +} +/* +void ExportWebDialog::setupJournalPage() +{ + mJournalPage = addPage(i18n("Journal")); + QVBoxLayout *topLayout = new QVBoxLayout( mJournalPage, 10 ); + + QHBox *hbox = new QHBox( mJournalPage ); + topLayout->addWidget( hbox ); + addWidString( mSettings->journalTitleItem(), hbox ); + + QVBox *vbox = new QVBox( mJournalPage ); + topLayout->addWidget( vbox ); +// addWidBool( mSettings->eventExcludeConfidentialItem(), vbox ); + + topLayout->addStretch(1); +} + +void ExportWebDialog::setupFreeBusyPage() +{ + mFreeBusyPage = addPage(i18n("Free/Busy")); + QVBoxLayout *topLayout = new QVBoxLayout( mFreeBusyPage, 10 ); + + QHBox *hbox = new QHBox( mFreeBusyPage ); + topLayout->addWidget( hbox ); + addWidString( mSettings->journalTitleItem(), hbox ); + + QVBox *vbox = new QVBox( mFreeBusyPage ); + topLayout->addWidget( vbox ); +// addWidBool( mSettings->eventExcludeConfidentialItem(), vbox ); + + topLayout->addStretch(1); +} + +void ExportWebDialog::setupAdvancedPage() +{ + mAdvancedPage = addPage(i18n("Advanced")); + QVBoxLayout *topLayout = new QVBoxLayout( mAdvancedPage, 10 ); + + QVBox *vbox = new QVBox( mAdvancedPage ); + topLayout->addWidget( vbox ); +// addWidBool( mSettings->eventExcludeConfidentialItem(), vbox ); + + topLayout->addStretch(1); +} +*/ -- cgit v1.2.1