• Skip to content
  • Skip to link menu
KDE 4.2 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 
00030 #include <libkdepim/kdateedit.h>
00031 
00032 #include <kcal/calendar.h>
00033 #include <kcal/htmlexportsettings.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 <QVBoxLayout>
00058 #include <QGroupBox>
00059 
00060 #include "exportwebdialog.moc"
00061 
00062 // FIXME: The basic structure of this dialog has been copied from KPrefsDialog,
00063 //        because we want custom buttons, a Tabbed dialog, and a different
00064 //        headline... Maybe we should try to achieve the same without code
00065 //        duplication.
00066 ExportWebDialog::ExportWebDialog( HTMLExportSettings *settings, QWidget *parent )
00067   : KPageDialog( parent ),
00068     KPrefsWidManager( settings ), mSettings( settings )
00069 {
00070   setFaceType( Tabbed );
00071   setCaption( i18n( "Export Calendar as Web Page" ) );
00072   setButtons( Help|Default|User1|Cancel );
00073   setDefaultButton( User1 );
00074   setModal( false );
00075   showButtonSeparator( false );
00076   setButtonText( User1, i18n( "Export" ) );
00077 
00078   setupGeneralPage();
00079   setupEventPage();
00080   setupTodoPage();
00081 // Disabled bacause the functionality is not yet implemented.
00082 //  setupJournalPage();
00083 //  setupFreeBusyPage();
00084 //  setupAdvancedPage();
00085 
00086   connect( this, SIGNAL(user1Clicked()), SLOT(slotOk()) );
00087   connect( this, SIGNAL(cancelClicked()), SLOT(reject()) );
00088   connect( this, SIGNAL(defaultClicked()), this, SLOT(slotDefault()) );
00089   connect( this, SIGNAL(applyClicked()), this, SLOT(slotApply()) );
00090   readConfig();
00091 }
00092 
00093 ExportWebDialog::~ExportWebDialog()
00094 {
00095 }
00096 
00097 void ExportWebDialog::setDefaults()
00098 {
00099   setWidDefaults();
00100 }
00101 
00102 void ExportWebDialog::readConfig()
00103 {
00104   readWidConfig();
00105   usrReadConfig();
00106 }
00107 
00108 void ExportWebDialog::writeConfig()
00109 {
00110   writeWidConfig();
00111   usrWriteConfig();
00112   readConfig();
00113 }
00114 
00115 void ExportWebDialog::slotApply()
00116 {
00117   writeConfig();
00118   emit configChanged();
00119 }
00120 
00121 void ExportWebDialog::slotOk()
00122 {
00123   slotApply();
00124   emit exportHTML( mSettings );
00125   accept();
00126 }
00127 
00128 void ExportWebDialog::slotDefault()
00129 {
00130   kDebug();
00131 
00132   if ( KMessageBox::warningContinueCancel(
00133          this,
00134          i18n( "You are about to set all preferences to default values. "
00135                "All custom modifications will be lost." ),
00136          i18n( "Setting Default Preferences" ),
00137       KGuiItem( i18n( "Reset to Defaults" ) ) ) == KMessageBox::Continue ) {
00138     setDefaults();
00139   }
00140 }
00141 
00142 void ExportWebDialog::setupGeneralPage()
00143 {
00144   mGeneralPage = new QFrame( this );
00145   addPage( mGeneralPage, i18nc( "general settings for html export", "General" ) );
00146   QVBoxLayout *topLayout = new QVBoxLayout( mGeneralPage );
00147   topLayout->setSpacing(10);
00148 
00149   QGroupBox *rangeGroup = new QGroupBox( i18n( "Date Range" ), mGeneralPage );
00150   topLayout->addWidget( rangeGroup );
00151 
00152   QHBoxLayout *rangeLayout = new QHBoxLayout( rangeGroup );
00153 
00154   KPrefsWidDate *dateStart = addWidDate( mSettings->dateStartItem() );
00155   rangeLayout->addWidget( dateStart->label() );
00156   rangeLayout->addWidget( dateStart->dateEdit() );
00157   KPrefsWidDate *dateEnd = addWidDate( mSettings->dateEndItem() );
00158   rangeLayout->addWidget( dateEnd->label() );
00159   rangeLayout->addWidget( dateEnd->dateEdit() );
00160 
00161   QGroupBox *typeGroup = new QGroupBox( i18n( "View Type" ), mGeneralPage );
00162   topLayout->addWidget( typeGroup );
00163 
00164   QBoxLayout *typeLayout = new QVBoxLayout( typeGroup );
00165 
00166   typeLayout->addWidget( addWidBool( mSettings->monthViewItem() )->checkBox() );
00167   typeLayout->addWidget( addWidBool( mSettings->eventViewItem() )->checkBox() );
00168   typeLayout->addWidget( addWidBool( mSettings->todoViewItem() )->checkBox() );
00169   typeLayout->addWidget(
00170     addWidBool( mSettings->excludePrivateItem() )->checkBox() );
00171   typeLayout->addWidget(
00172     addWidBool( mSettings->excludeConfidentialItem() )->checkBox() );
00173 
00174   QGroupBox *destGroup = new QGroupBox( i18n( "Destination" ), mGeneralPage );
00175   topLayout->addWidget( destGroup );
00176 
00177   QBoxLayout *destLayout = new QHBoxLayout( destGroup );
00178 
00179   KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
00180                                        destGroup, "text/html", KFile::File );
00181   connect( pathWid->urlRequester(), SIGNAL(textChanged(const QString&)),
00182            SLOT(slotTextChanged(const QString&)) );
00183   destLayout->addWidget( pathWid->label() );
00184   destLayout->addWidget( pathWid->urlRequester() );
00185 
00186   topLayout->addStretch( 1 );
00187 }
00188 
00189 void ExportWebDialog::slotTextChanged( const QString &_text )
00190 {
00191     enableButton( User1, !_text.isEmpty() );
00192 }
00193 
00194 void ExportWebDialog::setupTodoPage()
00195 {
00196   mTodoPage = new QFrame( this );
00197   addPage( mTodoPage, i18n( "To-dos" ) );
00198   QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage );
00199   topLayout->setSpacing( 10 );
00200 
00201   KHBox *hbox = new KHBox( mTodoPage );
00202   topLayout->addWidget( hbox );
00203   addWidString( mSettings->todoListTitleItem(), hbox );
00204 
00205   KVBox *vbox = new KVBox( mTodoPage );
00206   topLayout->addWidget( vbox );
00207   addWidBool( mSettings->taskDueDateItem(), vbox );
00208   addWidBool( mSettings->taskLocationItem(), vbox );
00209   addWidBool( mSettings->taskCategoriesItem(), vbox );
00210   addWidBool( mSettings->taskAttendeesItem(), vbox );
00211 //  addWidBool( mSettings->taskExcludePrivateItem(), vbox );
00212 //  addWidBool( mSettings->taskExcludeConfidentialItem(), vbox );
00213 
00214   topLayout->addStretch(1);
00215 }
00216 
00217 void ExportWebDialog::setupEventPage()
00218 {
00219   mEventPage = new QFrame( this );
00220   addPage( mEventPage, i18n( "Events" ) );
00221   QVBoxLayout *topLayout = new QVBoxLayout( mEventPage );
00222   topLayout->setSpacing( 10 );
00223 
00224   KHBox *hbox = new KHBox( mEventPage );
00225   topLayout->addWidget( hbox );
00226   addWidString( mSettings->eventTitleItem(), hbox );
00227 
00228   KVBox *vbox = new KVBox( mEventPage );
00229   topLayout->addWidget( vbox );
00230   addWidBool( mSettings->eventLocationItem(), vbox );
00231   addWidBool( mSettings->eventCategoriesItem(), vbox );
00232   addWidBool( mSettings->eventAttendeesItem(), vbox );
00233 //  addWidBool( mSettings->eventExcludePrivateItem(), vbox );
00234 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00235 
00236   topLayout->addStretch(1);
00237 }
00238 /*
00239 void ExportWebDialog::setupJournalPage()
00240 {
00241   mJournalPage = addPage(i18n("Journal"));
00242   QVBoxLayout *topLayout = new QVBoxLayout( mJournalPage );
00243   topLayout->setSpacing( 10 );
00244 
00245   QHBox *hbox = new QHBox( mJournalPage );
00246   topLayout->addWidget( hbox );
00247   addWidString( mSettings->journalTitleItem(), hbox );
00248 
00249   QVBox *vbox = new QVBox( mJournalPage );
00250   topLayout->addWidget( vbox );
00251 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00252 
00253   topLayout->addStretch(1);
00254 }
00255 
00256 void ExportWebDialog::setupFreeBusyPage()
00257 {
00258   mFreeBusyPage = addPage(i18n("Free/Busy"));
00259   QVBoxLayout *topLayout = new QVBoxLayout( mFreeBusyPage );
00260   topLayout->setSpacing( 10 );
00261 
00262   QHBox *hbox = new QHBox( mFreeBusyPage );
00263   topLayout->addWidget( hbox );
00264   addWidString( mSettings->journalTitleItem(), hbox );
00265 
00266   QVBox *vbox = new QVBox( mFreeBusyPage );
00267   topLayout->addWidget( vbox );
00268 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00269 
00270   topLayout->addStretch(1);
00271 }
00272 
00273 void ExportWebDialog::setupAdvancedPage()
00274 {
00275   mAdvancedPage = addPage(i18n("Advanced"));
00276   QVBoxLayout *topLayout = new QVBoxLayout( mAdvancedPage );
00277   topLayout->setSpacing( 10 );
00278 
00279   QVBox *vbox = new QVBox( mAdvancedPage );
00280   topLayout->addWidget( vbox );
00281 //  addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
00282 
00283   topLayout->addStretch(1);
00284 }
00285 */

korganizer

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
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