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

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
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.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  topLayout->addWidget( hbox );
193  addWidString( mSettings->todoListTitleItem(), hbox );
194 
195  KVBox *vbox = new KVBox( mTodoPage );
196  topLayout->addWidget( vbox );
197  addWidBool( mSettings->taskDueDateItem(), vbox );
198  addWidBool( mSettings->taskLocationItem(), vbox );
199  addWidBool( mSettings->taskCategoriesItem(), vbox );
200  addWidBool( mSettings->taskAttendeesItem(), vbox );
201 // addWidBool( mSettings->taskExcludePrivateItem(), vbox );
202 // addWidBool( mSettings->taskExcludeConfidentialItem(), vbox );
203 
204  topLayout->addStretch(1);
205 }
206 
207 void ExportWebDialog::setupEventPage()
208 {
209  mEventPage = new QFrame( this );
210  addPage( mEventPage, i18n( "Events" ) );
211  QVBoxLayout *topLayout = new QVBoxLayout( mEventPage );
212  topLayout->setSpacing( 10 );
213 
214  KHBox *hbox = new KHBox( mEventPage );
215  topLayout->addWidget( hbox );
216  addWidString( mSettings->eventTitleItem(), hbox );
217 
218  KVBox *vbox = new KVBox( mEventPage );
219  topLayout->addWidget( vbox );
220  addWidBool( mSettings->eventLocationItem(), vbox );
221  addWidBool( mSettings->eventCategoriesItem(), vbox );
222  addWidBool( mSettings->eventAttendeesItem(), vbox );
223 // addWidBool( mSettings->eventExcludePrivateItem(), vbox );
224 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
225 
226  topLayout->addStretch(1);
227 }
228 /*
229 void ExportWebDialog::setupJournalPage()
230 {
231  mJournalPage = addPage(i18n("Journal"));
232  QVBoxLayout *topLayout = new QVBoxLayout( mJournalPage );
233  topLayout->setSpacing( 10 );
234 
235  QHBox *hbox = new QHBox( mJournalPage );
236  topLayout->addWidget( hbox );
237  addWidString( mSettings->journalTitleItem(), hbox );
238 
239  QVBox *vbox = new QVBox( mJournalPage );
240  topLayout->addWidget( vbox );
241 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
242 
243  topLayout->addStretch(1);
244 }
245 
246 void ExportWebDialog::setupFreeBusyPage()
247 {
248  mFreeBusyPage = addPage(i18n("Free/Busy"));
249  QVBoxLayout *topLayout = new QVBoxLayout( mFreeBusyPage );
250  topLayout->setSpacing( 10 );
251 
252  QHBox *hbox = new QHBox( mFreeBusyPage );
253  topLayout->addWidget( hbox );
254  addWidString( mSettings->journalTitleItem(), hbox );
255 
256  QVBox *vbox = new QVBox( mFreeBusyPage );
257  topLayout->addWidget( vbox );
258 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
259 
260  topLayout->addStretch(1);
261 }
262 
263 void ExportWebDialog::setupAdvancedPage()
264 {
265  mAdvancedPage = addPage(i18n("Advanced"));
266  QVBoxLayout *topLayout = new QVBoxLayout( mAdvancedPage );
267  topLayout->setSpacing( 10 );
268 
269  QVBox *vbox = new QVBox( mAdvancedPage );
270  topLayout->addWidget( vbox );
271 // addWidBool( mSettings->eventExcludeConfidentialItem(), vbox );
272 
273  topLayout->addStretch(1);
274 }
275 */
276 
277 void ExportWebDialog::updateState()
278 {
279  const bool exportEvents = mMonthViewCheckBox->isChecked() ||
280  mEventListCheckBox->isChecked();
281  mDateRangeGroup->setEnabled( exportEvents );
282  mEventPage->setEnabled( exportEvents );
283 }
284 
285 #include "exportwebdialog.moc"
KPageDialog
ExportWebDialog::usrReadConfig
virtual void usrReadConfig()
Definition: exportwebdialog.h:71
KOrg::HTMLExportSettings::taskLocationItem
ItemBool * taskLocationItem()
Get Item object corresponding to TaskLocation()
Definition: htmlexportsettings.h:564
ExportWebDialog::slotDefault
void slotDefault()
Definition: exportwebdialog.cpp:111
KOrg::HTMLExportSettings
Definition: htmlexportsettings.h:12
KOrg::HTMLExportSettings::eventAttendeesItem
ItemBool * eventAttendeesItem()
Get Item object corresponding to EventAttendees()
Definition: htmlexportsettings.h:464
KOrg::HTMLExportSettings::taskAttendeesItem
ItemBool * taskAttendeesItem()
Get Item object corresponding to TaskAttendees()
Definition: htmlexportsettings.h:614
ExportWebDialog::slotOk
void slotOk()
Definition: exportwebdialog.cpp:104
ExportWebDialog::slotTextChanged
void slotTextChanged(const QString &_text)
Definition: exportwebdialog.cpp:179
QWidget
KOrg::HTMLExportSettings::eventCategoriesItem
ItemBool * eventCategoriesItem()
Get Item object corresponding to EventCategories()
Definition: htmlexportsettings.h:439
KOrg::HTMLExportSettings::outputFileItem
ItemPath * outputFileItem()
Get Item object corresponding to OutputFile()
Definition: htmlexportsettings.h:214
KOrg::HTMLExportSettings::taskDueDateItem
ItemBool * taskDueDateItem()
Get Item object corresponding to TaskDueDate()
Definition: htmlexportsettings.h:539
ExportWebDialog::setupGeneralPage
void setupGeneralPage()
Definition: exportwebdialog.cpp:125
ExportWebDialog::slotApply
void slotApply()
Definition: exportwebdialog.cpp:98
KOrg::HTMLExportSettings::taskCategoriesItem
ItemBool * taskCategoriesItem()
Get Item object corresponding to TaskCategories()
Definition: htmlexportsettings.h:589
ExportWebDialog::setupTodoPage
void setupTodoPage()
Definition: exportwebdialog.cpp:184
KOrg::HTMLExportSettings::todoViewItem
ItemBool * todoViewItem()
Get Item object corresponding to TodoView()
Definition: htmlexportsettings.h:489
KOrg::HTMLExportSettings::todoListTitleItem
ItemString * todoListTitleItem()
Get Item object corresponding to TodoListTitle()
Definition: htmlexportsettings.h:514
KOrg::HTMLExportSettings::dateStartItem
ItemDateTime * dateStartItem()
Get Item object corresponding to DateStart()
Definition: htmlexportsettings.h:164
KOrg::HTMLExportSettings::excludePrivateItem
ItemBool * excludePrivateItem()
Get Item object corresponding to ExcludePrivate()
Definition: htmlexportsettings.h:264
KOrg::HTMLExportSettings::eventViewItem
ItemBool * eventViewItem()
Get Item object corresponding to EventView()
Definition: htmlexportsettings.h:314
KOrg::HTMLExportSettings::eventLocationItem
ItemBool * eventLocationItem()
Get Item object corresponding to EventLocation()
Definition: htmlexportsettings.h:414
ExportWebDialog::setDefaults
void setDefaults()
Definition: exportwebdialog.cpp:80
exportwebdialog.h
ExportWebDialog::exportHTML
void exportHTML(KOrg::HTMLExportSettings *)
KOrg::HTMLExportSettings::eventTitleItem
ItemString * eventTitleItem()
Get Item object corresponding to EventTitle()
Definition: htmlexportsettings.h:389
KOrg::HTMLExportSettings::dateEndItem
ItemDateTime * dateEndItem()
Get Item object corresponding to DateEnd()
Definition: htmlexportsettings.h:189
ExportWebDialog::setupEventPage
void setupEventPage()
Definition: exportwebdialog.cpp:207
ExportWebDialog::~ExportWebDialog
virtual ~ExportWebDialog()
Definition: exportwebdialog.cpp:76
ExportWebDialog::ExportWebDialog
ExportWebDialog(KOrg::HTMLExportSettings *settings, QWidget *parent=0)
Definition: exportwebdialog.cpp:47
KOrg::HTMLExportSettings::monthViewItem
ItemBool * monthViewItem()
Get Item object corresponding to MonthView()
Definition: htmlexportsettings.h:339
ExportWebDialog::usrWriteConfig
virtual void usrWriteConfig()
Definition: exportwebdialog.h:72
KOrg::HTMLExportSettings::excludeConfidentialItem
ItemBool * excludeConfidentialItem()
Get Item object corresponding to ExcludeConfidential()
Definition: htmlexportsettings.h:289
htmlexportsettings.h
ExportWebDialog::writeConfig
void writeConfig()
Definition: exportwebdialog.cpp:91
ExportWebDialog::readConfig
void readConfig()
Definition: exportwebdialog.cpp:85
QFrame
ExportWebDialog::configChanged
void configChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 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

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