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

korganizer

  • sources
  • kde-4.14
  • kdepim
  • korganizer
  • dialog
exportwebdialog.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of Qt, and distribute the resulting executable,
23  without including the source code for Qt in the source distribution.
24 */
25 
26 #include "exportwebdialog.h"
27 #include "htmlexportsettings.h"
28 
29 #include <KDateComboBox>
30 #include <KFileDialog>
31 #include <KHBox>
32 #include <KMessageBox>
33 #include <KUrlRequester>
34 #include <KVBox>
35 
36 #include <QBoxLayout>
37 #include <QCheckBox>
38 #include <QGroupBox>
39 #include <QHBoxLayout>
40 #include <QLabel>
41 #include <QVBoxLayout>
42 
43 // FIXME: The basic structure of this dialog has been copied from KPrefsDialog,
44 // because we want custom buttons, a Tabbed dialog, and a different
45 // headline... Maybe we should try to achieve the same without code
46 // duplication.
47 ExportWebDialog::ExportWebDialog( KOrg::HTMLExportSettings *settings, QWidget *parent )
48  : KPageDialog( parent ), KPIM::KPrefsWidManager( settings ), mSettings( settings )
49 {
50  setAttribute(Qt::WA_DeleteOnClose);
51  setFaceType( Tabbed );
52  setCaption( i18n( "Export Calendar as Web Page" ) );
53  setButtons( /*Help|*/Default|User1|Cancel );
54  /*enableButton( KDialog::Help, false );*/
55  setDefaultButton( User1 );
56  setModal( false );
57  showButtonSeparator( false );
58  setButtonText( User1, i18n( "Export" ) );
59 
60  setupGeneralPage();
61  setupEventPage();
62  setupTodoPage();
63 // Disabled bacause the functionality is not yet implemented.
64 // setupJournalPage();
65 // setupFreeBusyPage();
66 // setupAdvancedPage();
67 
68  connect( this, SIGNAL(user1Clicked()), SLOT(slotOk()) );
69  connect( this, SIGNAL(cancelClicked()), SLOT(reject()) );
70  connect( this, SIGNAL(defaultClicked()), this, SLOT(slotDefault()) );
71  connect( this, SIGNAL(applyClicked()), this, SLOT(slotApply()) );
72  readConfig();
73  updateState();
74 }
75 
76 ExportWebDialog::~ExportWebDialog()
77 {
78 }
79 
80 void ExportWebDialog::setDefaults()
81 {
82  setWidDefaults();
83 }
84 
85 void ExportWebDialog::readConfig()
86 {
87  readWidConfig();
88  usrReadConfig();
89 }
90 
91 void ExportWebDialog::writeConfig()
92 {
93  writeWidConfig();
94  usrWriteConfig();
95  readConfig();
96 }
97 
98 void ExportWebDialog::slotApply()
99 {
100  writeConfig();
101  emit configChanged();
102 }
103 
104 void ExportWebDialog::slotOk()
105 {
106  slotApply();
107  emit exportHTML( mSettings );
108  accept();
109 }
110 
111 void ExportWebDialog::slotDefault()
112 {
113  kDebug();
114 
115  if ( KMessageBox::warningContinueCancel(
116  this,
117  i18n( "You are about to set all preferences to default values. "
118  "All custom modifications will be lost." ),
119  i18n( "Setting Default Preferences" ),
120  KGuiItem( i18n( "Reset to Defaults" ) ) ) == KMessageBox::Continue ) {
121  setDefaults();
122  }
123 }
124 
125 void ExportWebDialog::setupGeneralPage()
126 {
127  mGeneralPage = new QFrame( this );
128  addPage( mGeneralPage, i18nc( "general settings for html export", "General" ) );
129  QVBoxLayout *topLayout = new QVBoxLayout( mGeneralPage );
130  topLayout->setSpacing(10);
131 
132  mDateRangeGroup = new QGroupBox( i18n( "Date Range" ), mGeneralPage );
133  topLayout->addWidget( mDateRangeGroup );
134 
135  QHBoxLayout *rangeLayout = new QHBoxLayout( mDateRangeGroup );
136 
137  KPIM::KPrefsWidDate *dateStart = addWidDate( mSettings->dateStartItem() );
138  rangeLayout->addWidget( dateStart->label() );
139  rangeLayout->addWidget( dateStart->dateEdit() );
140  KPIM::KPrefsWidDate *dateEnd = addWidDate( mSettings->dateEndItem() );
141  rangeLayout->addWidget( dateEnd->label() );
142  rangeLayout->addWidget( dateEnd->dateEdit() );
143 
144  QGroupBox *typeGroup = new QGroupBox( i18n( "View Type" ), mGeneralPage );
145  topLayout->addWidget( typeGroup );
146 
147  QBoxLayout *typeLayout = new QVBoxLayout( typeGroup );
148 
149  mMonthViewCheckBox = addWidBool( mSettings->monthViewItem() )->checkBox();
150  connect( mMonthViewCheckBox, SIGNAL(stateChanged(int)), SLOT(updateState()) );
151  typeLayout->addWidget( mMonthViewCheckBox );
152 
153  mEventListCheckBox = addWidBool( mSettings->eventViewItem() )->checkBox();
154  connect( mEventListCheckBox, SIGNAL(stateChanged(int)), SLOT(updateState()) );
155  typeLayout->addWidget( mEventListCheckBox );
156 
157  typeLayout->addWidget( addWidBool( mSettings->todoViewItem() )->checkBox() );
158  typeLayout->addWidget(
159  addWidBool( mSettings->excludePrivateItem() )->checkBox() );
160  typeLayout->addWidget(
161  addWidBool( mSettings->excludeConfidentialItem() )->checkBox() );
162 
163  QGroupBox *destGroup = new QGroupBox( i18n( "Destination" ), mGeneralPage );
164  topLayout->addWidget( destGroup );
165 
166  QBoxLayout *destLayout = new QHBoxLayout( destGroup );
167 
168  KPIM::KPrefsWidPath *pathWid = addWidPath( mSettings->outputFileItem(),
169  destGroup, QLatin1String("text/html"), KFile::File );
170  pathWid->urlRequester()->fileDialog()->setOperationMode( KFileDialog::Saving );
171  connect( pathWid->urlRequester(), SIGNAL(textChanged(QString)),
172  SLOT(slotTextChanged(QString)) );
173  destLayout->addWidget( pathWid->label() );
174  destLayout->addWidget( pathWid->urlRequester() );
175 
176  topLayout->addStretch( 1 );
177 }
178 
179 void ExportWebDialog::slotTextChanged( const QString &_text )
180 {
181  enableButton( User1, !_text.trimmed().isEmpty() );
182 }
183 
184 void ExportWebDialog::setupTodoPage()
185 {
186  mTodoPage = new QFrame( this );
187  addPage( mTodoPage, i18n( "To-dos" ) );
188  QVBoxLayout *topLayout = new QVBoxLayout( mTodoPage );
189  topLayout->setSpacing( 10 );
190 
191  KHBox *hbox = new KHBox( mTodoPage );
192  hbox->setSpacing(10);
193  topLayout->addWidget( hbox );
194  addWidString( mSettings->todoListTitleItem(), hbox );
195 
196  KVBox *vbox = new KVBox( mTodoPage );
197  topLayout->addWidget( vbox );
198  addWidBool( mSettings->taskDueDateItem(), vbox );
199  addWidBool( mSettings->taskLocationItem(), vbox );
200  addWidBool( mSettings->taskCategoriesItem(), vbox );
201  addWidBool( mSettings->taskAttendeesItem(), vbox );
202 // addWidBool( mSettings->taskExcludePrivateItem(), vbox );
203 // addWidBool( mSettings->taskExcludeConfidentialItem(), vbox );
204 
205  topLayout->addStretch(1);
206 }
207 
208 void ExportWebDialog::setupEventPage()
209 {
210  mEventPage = new QFrame( this );
211  addPage( mEventPage, i18n( "Events" ) );
212  QVBoxLayout *topLayout = new QVBoxLayout( mEventPage );
213  topLayout->setSpacing( 10 );
214 
215  KHBox *hbox = new KHBox( mEventPage );
216  hbox->setSpacing(10);
217  topLayout->addWidget( hbox );
218  addWidString( mSettings->eventTitleItem(), hbox );
219 
220  KVBox *vbox = new KVBox( mEventPage );
221  topLayout->addWidget( vbox );
222  addWidBool( mSettings->eventLocationItem(), vbox );
223  addWidBool( mSettings->eventCategoriesItem(), vbox );
224  addWidBool( mSettings->eventAttendeesItem(), vbox );
225 // addWidBool( mSettings->eventExcludePrivateItem(), vbox );
226 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
227 
228  topLayout->addStretch(1);
229 }
230 /*
231 void ExportWebDialog::setupJournalPage()
232 {
233  mJournalPage = addPage(i18n("Journal"));
234  QVBoxLayout *topLayout = new QVBoxLayout( mJournalPage );
235  topLayout->setSpacing( 10 );
236 
237  QHBox *hbox = new QHBox( mJournalPage );
238  topLayout->addWidget( hbox );
239  addWidString( mSettings->journalTitleItem(), hbox );
240 
241  QVBox *vbox = new QVBox( mJournalPage );
242  topLayout->addWidget( vbox );
243 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
244 
245  topLayout->addStretch(1);
246 }
247 
248 void ExportWebDialog::setupFreeBusyPage()
249 {
250  mFreeBusyPage = addPage(i18n("Free/Busy"));
251  QVBoxLayout *topLayout = new QVBoxLayout( mFreeBusyPage );
252  topLayout->setSpacing( 10 );
253 
254  QHBox *hbox = new QHBox( mFreeBusyPage );
255  topLayout->addWidget( hbox );
256  addWidString( mSettings->journalTitleItem(), hbox );
257 
258  QVBox *vbox = new QVBox( mFreeBusyPage );
259  topLayout->addWidget( vbox );
260 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
261 
262  topLayout->addStretch(1);
263 }
264 
265 void ExportWebDialog::setupAdvancedPage()
266 {
267  mAdvancedPage = addPage(i18n("Advanced"));
268  QVBoxLayout *topLayout = new QVBoxLayout( mAdvancedPage );
269  topLayout->setSpacing( 10 );
270 
271  QVBox *vbox = new QVBox( mAdvancedPage );
272  topLayout->addWidget( vbox );
273 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
274 
275  topLayout->addStretch(1);
276 }
277 */
278 
279 void ExportWebDialog::updateState()
280 {
281  const bool exportEvents = mMonthViewCheckBox->isChecked() ||
282  mEventListCheckBox->isChecked();
283  mDateRangeGroup->setEnabled( exportEvents );
284  mEventPage->setEnabled( exportEvents );
285 }
286 
QWidget
KPageDialog
ExportWebDialog::usrReadConfig
virtual void usrReadConfig()
Definition: exportwebdialog.h:71
ExportWebDialog::slotDefault
void slotDefault()
Definition: exportwebdialog.cpp:111
ExportWebDialog::slotOk
void slotOk()
Definition: exportwebdialog.cpp:104
ExportWebDialog::slotTextChanged
void slotTextChanged(const QString &_text)
Definition: exportwebdialog.cpp:179
QHBoxLayout
ExportWebDialog::setupGeneralPage
void setupGeneralPage()
Definition: exportwebdialog.cpp:125
ExportWebDialog::slotApply
void slotApply()
Definition: exportwebdialog.cpp:98
ExportWebDialog::setupTodoPage
void setupTodoPage()
Definition: exportwebdialog.cpp:184
QWidget::setEnabled
void setEnabled(bool)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QGroupBox
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
QVBoxLayout
ExportWebDialog::setDefaults
void setDefaults()
Definition: exportwebdialog.cpp:80
QString
exportwebdialog.h
ExportWebDialog::exportHTML
void exportHTML(KOrg::HTMLExportSettings *)
ExportWebDialog::setupEventPage
void setupEventPage()
Definition: exportwebdialog.cpp:208
ExportWebDialog::~ExportWebDialog
virtual ~ExportWebDialog()
Definition: exportwebdialog.cpp:76
QFrame
QAbstractButton::isChecked
bool isChecked() const
ExportWebDialog::ExportWebDialog
ExportWebDialog(KOrg::HTMLExportSettings *settings, QWidget *parent=0)
Definition: exportwebdialog.cpp:47
QLatin1String
QBoxLayout::addStretch
void addStretch(int stretch)
ExportWebDialog::usrWriteConfig
virtual void usrWriteConfig()
Definition: exportwebdialog.h:72
ExportWebDialog::writeConfig
void writeConfig()
Definition: exportwebdialog.cpp:91
ExportWebDialog::readConfig
void readConfig()
Definition: exportwebdialog.cpp:85
QBoxLayout
QBoxLayout::setSpacing
void setSpacing(int spacing)
ExportWebDialog::configChanged
void configChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal