• Skip to content
  • Skip to link menu
KDE 4.5 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

korganizer

exportwebdialog.cpp

Go to the documentation of this file.
00001 /*
00002   This file is part of KOrganizer.
00003 
00004   Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005   Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007   This program is free software; you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation; either version 2 of the License, or
00010   (at your option) any later version.
00011 
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License along
00018   with this program; if not, write to the Free Software Foundation, Inc.,
00019   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021   As a special exception, permission is given to link this program
00022   with any edition of Qt, and distribute the resulting executable,
00023   without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #include "exportwebdialog.h"
00027 #include "koprefs.h"
00028 #include "kocore.h"
00029 #include "htmlexportsettings.h"
00030 
00031 #include <libkdepim/kdateedit.h>
00032 
00033 #include <akonadi/kcal/calendar.h>
00034 
00035 #include <klocale.h>
00036 #include <kdebug.h>
00037 #include <kfiledialog.h>
00038 #include <klineedit.h>
00039 #include <kurl.h>
00040 #include <kio/job.h>
00041 #include <kstandarddirs.h>
00042 #include <kconfig.h>
00043 #include "koglobals.h"
00044 #include <kurlrequester.h>
00045 #include <kio/netaccess.h>
00046 #include <ktemporaryfile.h>
00047 #include <kmessagebox.h>
00048 #include <kvbox.h>
00049 
00050 #include <QLayout>
00051 #include <QRadioButton>
00052 #include <QCheckBox>
00053 #include <QLineEdit>
00054 #include <QPushButton>
00055 #include <QTextStream>
00056 #include <QLabel>
00057 #include <QHBoxLayout>
00058 #include <QVBoxLayout>
00059 #include <QGroupBox>
00060 
00061 #include "exportwebdialog.moc"
00062 
00063 // FIXME: The basic structure of this dialog has been copied from KPrefsDialog,
00064 //        because we want custom buttons, a Tabbed dialog, and a different
00065 //        headline... Maybe we should try to achieve the same without code
00066 //        duplication.
00067 ExportWebDialog::ExportWebDialog( KOrg::HTMLExportSettings *settings, QWidget *parent )
00068   : KPageDialog( parent ),
00069     KPrefsWidManager( settings ), mSettings( settings )
00070 {
00071   setFaceType( Tabbed );
00072   setCaption( i18n( "Export Calendar as Web Page" ) );
00073   setButtons( Help|Default|User1|Cancel );
00074   setDefaultButton( User1 );
00075   setModal( false );
00076   showButtonSeparator( false );
00077   setButtonText( User1, i18n( "Export" ) );
00078 
00079   setupGeneralPage();
00080   setupEventPage();
00081   setupTodoPage();
00082 // Disabled bacause the functionality is not yet implemented.
00083 //  setupJournalPage();
00084 //  setupFreeBusyPage();
00085 //  setupAdvancedPage();
00086 
00087   connect( this, SIGNAL(user1Clicked()), SLOT(slotOk()) );
00088   connect( this, SIGNAL(cancelClicked()), SLOT(reject()) );
00089   connect( this, SIGNAL(defaultClicked()), this, SLOT(slotDefault()) );
00090   connect( this, SIGNAL(applyClicked()), this, SLOT(slotApply()) );
00091   readConfig();
00092   updateState();
00093 }
00094 
00095 ExportWebDialog::~ExportWebDialog()
00096 {
00097 }
00098 
00099 void ExportWebDialog::setDefaults()
00100 {
00101   setWidDefaults();
00102 }
00103 
00104 void ExportWebDialog::readConfig()
00105 {
00106   readWidConfig();
00107   usrReadConfig();
00108 }
00109 
00110 void ExportWebDialog::writeConfig()
00111 {
00112   writeWidConfig();
00113   usrWriteConfig();
00114   readConfig();
00115 }
00116 
00117 void ExportWebDialog::slotApply()
00118 {
00119   writeConfig();
00120   emit configChanged();
00121 }
00122 
00123 void ExportWebDialog::slotOk()
00124 {
00125   slotApply();
00126   emit exportHTML( mSettings );
00127   accept();
00128 }
00129 
00130 void ExportWebDialog::slotDefault()
00131 {
00132   kDebug();
00133 
00134   if ( KMessageBox::warningContinueCancel(
00135          this,
00136          i18n( "You are about to set all preferences to default values. "
00137                "All custom modifications will be lost." ),
00138          i18n( "Setting Default Preferences" ),
00139       KGuiItem( i18n( "Reset to Defaults" ) ) ) == KMessageBox::Continue ) {
00140     setDefaults();
00141   }
00142 }
00143 
00144 void ExportWebDialog::setupGeneralPage()
00145 {
00146   mGeneralPage = new QFrame( this );
00147   addPage( mGeneralPage, i18nc( "general settings for html export", "General" ) );
00148   QVBoxLayout *topLayout = new QVBoxLayout( mGeneralPage );
00149   topLayout->setSpacing(10);
00150 
00151   mDateRangeGroup = new QGroupBox( i18n( "Date Range" ), mGeneralPage );
00152   topLayout->addWidget( mDateRangeGroup );
00153 
00154   QHBoxLayout *rangeLayout = new QHBoxLayout( mDateRangeGroup );
00155 
00156   KPrefsWidDate *dateStart = addWidDate( mSettings->dateStartItem() );
00157   rangeLayout->addWidget( dateStart->label() );
00158   rangeLayout->addWidget( dateStart->dateEdit() );
00159   KPrefsWidDate *dateEnd = addWidDate( mSettings->dateEndItem() );
00160   rangeLayout->addWidget( dateEnd->label() );
00161   rangeLayout->addWidget( dateEnd->dateEdit() );
00162 
00163   QGroupBox *typeGroup = new QGroupBox( i18n( "View Type" ), mGeneralPage );
00164   topLayout->addWidget( typeGroup );
00165 
00166   QBoxLayout *typeLayout = new QVBoxLayout( typeGroup );
00167 
00168   mMonthViewCheckBox = addWidBool( mSettings->monthViewItem() )->checkBox();
00169   connect( mMonthViewCheckBox, SIGNAL(stateChanged(int)), SLOT(updateState()) );
00170   typeLayout->addWidget( mMonthViewCheckBox );
00171 
00172   mEventListCheckBox = addWidBool( mSettings->eventViewItem() )->checkBox();
00173   connect( mEventListCheckBox, SIGNAL(stateChanged(int)), SLOT(updateState()) );
00174   typeLayout->addWidget( mEventListCheckBox );
00175 
00176   typeLayout->addWidget( addWidBool( mSettings->todoViewItem() )->checkBox() );
00177   typeLayout->addWidget(
00178     addWidBool( mSettings->excludePrivateItem() )->checkBox() );
00179   typeLayout->addWidget(
00180     addWidBool( mSettings->excludeConfidentialItem() )->checkBox() );
00181 
00182   QGroupBox *destGroup = new QGroupBox( i18n( "Destination" ), mGeneralPage );
00183   topLayout->addWidget( destGroup );
00184 
00185   QBoxLayout *destLayout = new QHBoxLayout( destGroup );
00186 
00187   KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
00188                                        destGroup, "text/html", KFile::File );
00189   connect( pathWid->urlRequester(), SIGNAL(textChanged(const QString&)),
00190            SLOT(slotTextChanged(const QString&)) );
00191   destLayout->addWidget( pathWid->label() );
00192   destLayout->addWidget( pathWid->urlRequester() );
00193 
00194   topLayout->addStretch( 1 );
00195 }
00196 
00197 void ExportWebDialog::slotTextChanged( const QString &_text )
00198 {
00199     enableButton( User1, !_text.isEmpty() );
00200 }
00201 
00202 void ExportWebDialog::setupTodoPage()
00203 {
00204   mTodoPage = new QFrame( this );
00205   addPage( mTodoPage, i18n( "To-dos" ) );
00206   QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage );
00207   topLayout->setSpacing( 10 );
00208 
00209   KHBox *hbox = new KHBox( mTodoPage );
00210   topLayout->addWidget( hbox );
00211   addWidString( mSettings->todoListTitleItem(), hbox );
00212 
00213   KVBox *vbox = new KVBox( mTodoPage );
00214   topLayout->addWidget( vbox );
00215   addWidBool( mSettings->taskDueDateItem(), vbox );
00216   addWidBool( mSettings->taskLocationItem(), vbox );
00217   addWidBool( mSettings->taskCategoriesItem(), vbox );
00218   addWidBool( mSettings->taskAttendeesItem(), vbox );
00219 //  addWidBool( mSettings->taskExcludePrivateItem(), vbox );
00220 //  addWidBool( mSettings->taskExcludeConfidentialItem(), vbox );
00221 
00222   topLayout->addStretch(1);
00223 }
00224 
00225 void ExportWebDialog::setupEventPage()
00226 {
00227   mEventPage = new QFrame( this );
00228   addPage( mEventPage, i18n( "Events" ) );
00229   QVBoxLayout *topLayout = new QVBoxLayout( mEventPage );
00230   topLayout->setSpacing( 10 );
00231 
00232   KHBox *hbox = new KHBox( mEventPage );
00233   topLayout->addWidget( hbox );
00234   addWidString( mSettings->eventTitleItem(), hbox );
00235 
00236   KVBox *vbox = new KVBox( mEventPage );
00237   topLayout->addWidget( vbox );
00238   addWidBool( mSettings->eventLocationItem(), vbox );
00239   addWidBool( mSettings->eventCategoriesItem(), vbox );
00240   addWidBool( mSettings->eventAttendeesItem(), vbox );
00241 //  addWidBool( mSettings->eventExcludePrivateItem(), vbox );
00242 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00243 
00244   topLayout->addStretch(1);
00245 }
00246 /*
00247 void ExportWebDialog::setupJournalPage()
00248 {
00249   mJournalPage = addPage(i18n("Journal"));
00250   QVBoxLayout *topLayout = new QVBoxLayout( mJournalPage );
00251   topLayout->setSpacing( 10 );
00252 
00253   QHBox *hbox = new QHBox( mJournalPage );
00254   topLayout->addWidget( hbox );
00255   addWidString( mSettings->journalTitleItem(), hbox );
00256 
00257   QVBox *vbox = new QVBox( mJournalPage );
00258   topLayout->addWidget( vbox );
00259 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00260 
00261   topLayout->addStretch(1);
00262 }
00263 
00264 void ExportWebDialog::setupFreeBusyPage()
00265 {
00266   mFreeBusyPage = addPage(i18n("Free/Busy"));
00267   QVBoxLayout *topLayout = new QVBoxLayout( mFreeBusyPage );
00268   topLayout->setSpacing( 10 );
00269 
00270   QHBox *hbox = new QHBox( mFreeBusyPage );
00271   topLayout->addWidget( hbox );
00272   addWidString( mSettings->journalTitleItem(), hbox );
00273 
00274   QVBox *vbox = new QVBox( mFreeBusyPage );
00275   topLayout->addWidget( vbox );
00276 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00277 
00278   topLayout->addStretch(1);
00279 }
00280 
00281 void ExportWebDialog::setupAdvancedPage()
00282 {
00283   mAdvancedPage = addPage(i18n("Advanced"));
00284   QVBoxLayout *topLayout = new QVBoxLayout( mAdvancedPage );
00285   topLayout->setSpacing( 10 );
00286 
00287   QVBox *vbox = new QVBox( mAdvancedPage );
00288   topLayout->addWidget( vbox );
00289 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00290 
00291   topLayout->addStretch(1);
00292 }
00293 */
00294 
00295 void ExportWebDialog::updateState()
00296 {
00297   const bool exportEvents = mMonthViewCheckBox->isChecked() ||
00298                             mEventListCheckBox->isChecked();
00299   mDateRangeGroup->setEnabled( exportEvents );
00300   mEventPage->setEnabled( exportEvents );
00301 }
00302 

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdepim

Skip menu "kdepim"
  •   akonadi_next
  •   kcal
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korganizer
  •   korgac
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • messageviewer
  • runtime
  •   kcm
  •       libmaildir
Generated for kdepim by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal