Commit c96f79da authored by Volker Krause's avatar Volker Krause

Remove the HTML export feature

As agreed during the PIM sprint in Toulouse last weekend. It generates
HTML3-style output, doesn't handle recurring events in different timezones
correctly and addresses a use-case that has been better solved by the
meanwhile invented groupware servers.
parent e5048754
......@@ -134,7 +134,7 @@ you keep your schedule.</para>
<para>But &korganizer; is not only about your personal calendar, it can
help you to interact with your colleagues and friends too. With &korganizer;,
you can publish a calendar as a web page, invite anyone with an email address
you can invite anyone with an email address
to an event and process responses, share a calendar (using a groupware
server or simply a file over the network), and share events (&eg;
the schedule of a championship or a conference), using the get hot new stuff
......@@ -361,10 +361,9 @@ import the data (merge) into an existing resource and open the file in a new
window too. Importing files in the format used by the old
<application>ical</application> application is also supported.</para>
<para>You can export your data as a web page, as an iCalendar or
<para>You can export your data as an iCalendar or
vCalendar file. These files are supported by most scheduling applications.
The web page can be used to publish your calendar and to-do list on the
web or on the local network.</para>
</para>
<para>In this chapter, we will explain how to manage your calendar, using the
resources, import and export actions and the get hot new stuff scheme.</para>
......@@ -530,10 +529,9 @@ store.kde.org KOrganizer Calendars-->
<sect2 id="managing-export">
<title>Exporting Calendars</title>
<para>You can export your data as a web page, or as an iCalendar or
<para>You can export your data as an iCalendar or
vCalendar file, which are supported by most scheduling applications.
The web page can be used to publish your calendar and to-do list on the
web or on the local network. Either way, &korganizer; will export all calendar
Either way, &korganizer; will export all calendar
items from the enabled (checked) resources which are
<link linkend="filters-view">not filtered out</link> (let's call these items
<quote>active</quote> items). In other words, if you cannot see a calendar
......@@ -556,42 +554,6 @@ data as a new vCalendar file choose the <menuchoice><guimenu>File</guimenu>
Enter the file name and location for the new file to complete the export
action.</para>
<para>You can export your calendar or a part of it as an &HTML;
file, suitable for publishing on the web. Anyone with access to this file,
using a web browser, will be able to view it. This is an easy way to share
calendar information with your colleagues and friends.</para>
<!--TODO: use case: export your friends birthdays?-->
<procedure id="procedure-export-html">
<step><para>Disable all the resources you do not want to export, and filter out
the items you do not want to export.</para></step>
<step><para>Choose the <menuchoice><guimenu>File</guimenu>
<guisubmenu>Export</guisubmenu><guimenuitem>Export Web Page...</guimenuitem>
</menuchoice> menu item. You will get a window with three tabs:
<guilabel>General</guilabel>, <guilabel>Events</guilabel>, and
<guilabel>To-dos</guilabel>.</para></step>
<step><para><guilabel>General</guilabel> tab:</para>
<substeps>
<step><para>Specify the date range that you want published. Enter dates
manually or use the Calendar Widget.</para></step>
<step><para>If you want to export to-dos, check the <guilabel>Export
to-do list</guilabel> box.</para></step>
<step><para>If you want to export the items displayed in the Month view, check the
<guilabel>Export in month view</guilabel> box.</para></step>
<step><para>If you want to export events formatted as a list of events, check the
<guilabel>Export events as list</guilabel> box.</para></step>
<step><para>Specify the web output file in the <guilabel>Output filename</guilabel>
field. If you want to set another location, press the <inlinemediaobject>
<imageobject><imagedata fileref="document-open.png" format="PNG"/></imageobject><!--wrong png-->
</inlinemediaobject><guibutton>Open file dialog</guibutton> button to find it.</para></step>
</substeps></step>
<step><para><guilabel>Events</guilabel> tab: specify if you want to include
categories and attendees in the exported web page.</para></step>
<step><para><guilabel>To-dos</guilabel> tab: specify if you want to list Due
Dates, Categories, and Attendees.</para></step>
</procedure>
</sect2>
<sect2 id="managing-purge-archive">
......@@ -2087,13 +2049,6 @@ the email excluding attachments or only a link to the email.</para>
<variablelist>
<varlistentry>
<term><guilabel>Export to &HTML; periodically</guilabel></term>
<listitem><para>By checking this option, you can order &korganizer; to export
your calendar and to-do list to an &HTML; file in your home folder at an interval
which defaults to 10 minutes.</para></listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Confirm deletes</guilabel></term>
<listitem><para>When you check <guilabel>Confirm deletes</guilabel> box,
......@@ -2928,18 +2883,6 @@ added to your calendar.</para>
</listitem>
</varlistentry>
<varlistentry id="menu-file-export-as-web">
<term><menuchoice>
<guimenu>File</guimenu>
<guisubmenu>Export</guisubmenu>
<guimenuitem>Export Web Page...</guimenuitem>
</menuchoice></term>
<listitem><para><action>You can export your calendar or a part of it as a &HTML;
file, suitable for publishing on the World Wide Web.</action></para>
<para>For more information about this action, please refer to
<xref linkend="managing-export" />.</para></listitem>
</varlistentry>
<varlistentry id="menu-file-export-icalendar">
<term><menuchoice>
<guimenu>File</guimenu>
......
......@@ -165,9 +165,7 @@ set(korganizerprivate_LIB_SRCS
datechecker.cpp
datenavigator.cpp
datenavigatorcontainer.cpp
dialog/exportwebdialog.cpp
dialog/filtereditdialog.cpp
job/htmlexportjob.cpp
widgets/kdatenavigator.cpp
kocheckableproxymodel.cpp
kocorehelper.cpp
......@@ -196,8 +194,6 @@ set(korganizerprivate_LIB_SRCS
views/whatsnextview/kowhatsnextview.cpp
)
kconfig_add_kcfg_files(korganizerprivate_LIB_SRCS settings/htmlexportsettings.kcfgc)
ki18n_wrap_ui(korganizerprivate_LIB_SRCS
ui/filteredit_base.ui
ui/kogroupwareprefspage.ui
......
......@@ -32,8 +32,6 @@
#include "akonadicollectionview.h"
#include "calendaradaptor.h"
#include "calendarview.h"
#include "job/htmlexportjob.h"
#include "htmlexportsettings.h"
#include "kocore.h"
#include "kodialogmanager.h"
#include "korganizeradaptor.h"
......@@ -113,7 +111,6 @@ ActionManager::ActionManager(KXMLGUIClient *client, CalendarView *widget,
mCalendarView = widget;
mIsPart = isPart;
mTempFile = nullptr;
mHtmlExportSync = false;
mMainWindow = mainWindow;
mMenuBar = menuBar;
}
......@@ -168,14 +165,6 @@ void ActionManager::init()
// initialize the QAction instances
initActions();
// set up autoExporting stuff
mAutoExportTimer = new QTimer(this);
connect(mAutoExportTimer, &QTimer::timeout, this, &ActionManager::checkAutoExport);
if (KOPrefs::instance()->mAutoExport &&
KOPrefs::instance()->mAutoExportInterval > 0) {
mAutoExportTimer->start(1000 * 60 * KOPrefs::instance()->mAutoExportInterval);
}
// set up autoSaving stuff
mAutoArchiveTimer = new QTimer(this);
mAutoArchiveTimer->setSingleShot(true);
......@@ -193,8 +182,6 @@ void ActionManager::init()
connect(mCalendarView, &CalendarView::incidenceSelected,
this, &ActionManager::processIncidenceSelection);
connect(mCalendarView, SIGNAL(exportHTML(KOrg::HTMLExportSettings*)),
this, SLOT(exportHTML(KOrg::HTMLExportSettings*)));
processIncidenceSelection(Akonadi::Item(), QDate());
......@@ -293,10 +280,6 @@ void ActionManager::initActions()
mACollection->addAction(QStringLiteral("downloadnewstuff"), action);
connect(action, &QAction::triggered, this, &ActionManager::downloadNewStuff);
action = new QAction(i18n("Export &Web Page..."), this);
mACollection->addAction(QStringLiteral("export_web"), action);
connect(action, &QAction::triggered, mCalendarView, &CalendarView::exportWeb);
action = new QAction(i18n("Export as &iCalendar..."), this);
mACollection->addAction(QStringLiteral("export_icalendar"), action);
connect(action, &QAction::triggered, mCalendarView, &CalendarView::exportICalendar);
......@@ -993,91 +976,6 @@ bool ActionManager::saveURL()
return true;
}
void ActionManager::exportHTML()
{
HTMLExportSettings *settings = new HTMLExportSettings(QStringLiteral("KOrganizer"));
mSettingsToFree.insert(settings);
// Manually read in the config, because parametrized kconfigxt objects don't
// seem to load the config theirselves
settings->load();
const QDate qd1 = QDate::currentDate();
QDate qd2 = qd1;
if (settings->monthView()) {
qd2 = qd2.addMonths(1);
} else {
qd2 = qd2.addDays(7);
}
settings->setDateStart(QDateTime(qd1));
settings->setDateEnd(QDateTime(qd2));
exportHTML(settings, true/*autoMode*/);
}
void ActionManager::exportHTML(KOrg::HTMLExportSettings *settings, bool autoMode)
{
if (!settings) {
qCWarning(KORGANIZER_LOG) << "Settings is null" << settings;
return;
}
if (settings->outputFile().isEmpty()) {
int result = KMessageBox::questionYesNo(
dialogParent(),
i18n("The HTML calendar export file has not been specified yet.\n"
"Do you want to set it now?\n\n"
"If you answer \"no\" then this export operation will be canceled"),
QString());
if (result == KMessageBox::No) {
mMainWindow->showStatusMessage(
i18nc("@info:status",
"Calendar HTML operation canceled due to unspecified output file name"));
return;
}
const QString fileName =
QFileDialog::getSaveFileName(dialogParent(), i18n("Select path for HTML calendar export"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation),
i18n("HTML Files (*.html)"));
settings->setOutputFile(fileName);
settings->save();
}
if (!autoMode && QFileInfo(settings->outputFile()).exists()) {
if (KMessageBox::warningContinueCancel(
dialogParent(),
i18n("Do you want to overwrite file \"%1\"?",
settings->outputFile()),
QString(),
KStandardGuiItem::overwrite()) == KMessageBox::Cancel) {
mMainWindow->showStatusMessage(
i18nc("@info:status",
"Calendar HTML operation canceled due to output file overwrite"));
return;
}
}
settings->setEMail(CalendarSupport::KCalPrefs::instance()->email());
settings->setName(CalendarSupport::KCalPrefs::instance()->fullName());
settings->setCreditName(QStringLiteral("KOrganizer"));
settings->setCreditURL(QStringLiteral("http://korganizer.kde.org"));
KOrg::HtmlExportJob *exportJob = new KOrg::HtmlExportJob(calendar(), settings, autoMode, mMainWindow, view());
if (KOGlobals::self()->holidays()) {
const KHolidays::Holiday::List holidays = KOGlobals::self()->holidays()->holidays(
settings->dateStart().date(), settings->dateEnd().date());
for (const KHolidays::Holiday &holiday : holidays) {
exportJob->addHoliday(holiday.observedStartDate(), holiday.name());
}
}
connect(exportJob, &KOrg::HtmlExportJob::result, this, &ActionManager::handleExportJobResult);
exportJob->start();
}
bool ActionManager::saveAsURL(const QUrl &url)
{
qCDebug(KORGANIZER_LOG) << url.toDisplayString();
......@@ -1890,19 +1788,6 @@ QWidget *ActionManager::dialogParent()
return mCalendarView->topLevelWidget();
}
void ActionManager::checkAutoExport()
{
// Don't save if auto save interval is zero
if (KOPrefs::instance()->mAutoExportInterval == 0) {
return;
}
// has this calendar been saved before? If yes automatically save it.
if (KOPrefs::instance()->mAutoExport) {
exportHTML();
}
}
void ActionManager::openTodoEditor(const QString &summary,
const QString &description,
const QStringList &attachmentUris,
......@@ -1935,17 +1820,6 @@ void ActionManager::openEventEditor(const QString &summary,
qCWarning(KORGANIZER_LOG) << "Not implemented in korg-desktop";
}
void ActionManager::handleExportJobResult(KJob *job)
{
HtmlExportJob *htmlExportJob = qobject_cast<HtmlExportJob *>(job);
Q_ASSERT(htmlExportJob);
if (mSettingsToFree.contains(htmlExportJob->settings())) {
mSettingsToFree.remove(htmlExportJob->settings());
delete htmlExportJob->settings();
}
}
void ActionManager::setHelpText(QAction *act, const QString &text)
{
act->setStatusTip(text);
......
......@@ -43,10 +43,6 @@
class AkonadiCollectionView;
class CalendarView;
class KOWindowList;
namespace KOrg
{
class HTMLExportSettings;
}
namespace Akonadi
{
......@@ -96,19 +92,6 @@ public Q_SLOTS:
/** Save calendar file to URL */
bool saveAsURL(const QUrl &QUrl);
/**
Export the calendar to an HTML file. Reads up the user settings as needed.
Intended to be used as part of the auto HTML export feature.
*/
void exportHTML();
/**
Export the calendar to an HTML file, per the user settings.
@param settings is a pointer to an KOrg::HTMLExportSettings instance.
@param autoMode if true, indicates that this export is for an autosave;
if false, then the export is explicitly user invoked.
*/
void exportHTML(KOrg::HTMLExportSettings *settings, bool autoMode = false);
void toggleMenubar(bool dontShowWarning = false);
public:
......@@ -270,9 +253,6 @@ public Q_SLOTS:
protected Q_SLOTS:
void setItems(const QStringList &, int);
/** called by the autoExportTimer to automatically export the calendar */
void checkAutoExport();
/** open new window */
//void file_new();
......@@ -324,7 +304,6 @@ protected:
QWidget *dialogParent();
private Q_SLOTS:
void handleExportJobResult(KJob *);
void dumpText(const QString &); // only for debugging purposes
void slotDefaultResourceChanged(const Akonadi::Collection &);
......@@ -405,12 +384,10 @@ private:
CalendarView *mCalendarView;
KOrg::MainWindow *mMainWindow;
bool mIsPart;
bool mHtmlExportSync;
AkonadiCollectionView *mCollectionView;
KViewStateMaintainer<Akonadi::ETMViewStateSaver> *mCollectionViewStateSaver;
KViewStateMaintainer<Akonadi::ETMViewStateSaver> *mCollectionSelectionModelStateSaver;
QSet<KOrg::HTMLExportSettings *> mSettingsToFree;
};
#endif
......@@ -33,7 +33,6 @@
#include "datechecker.h"
#include "datenavigator.h"
#include "datenavigatorcontainer.h"
#include "dialog/exportwebdialog.h"
#include "kocorehelper.h"
#include "kodaymatrix.h"
#include "kodialogmanager.h"
......@@ -42,7 +41,6 @@
#include "kohelper.h"
#include "prefs/koprefs.h"
#include "koviewmanager.h"
#include "htmlexportsettings.h"
#include "widgets/navigatorbar.h"
#include "views/agendaview/koagendaview.h"
#include "views/monthview/monthview.h"
......@@ -1818,19 +1816,6 @@ void CalendarView::printPreview()
selectedIncidences, true);
}
void CalendarView::exportWeb()
{
KOrg::HTMLExportSettings *settings = new KOrg::HTMLExportSettings(QStringLiteral("KOrganizer"));
Q_ASSERT(settings);
// Manually read in the config, because parameterized kconfigxt objects don't
// seem to load the config theirselves
settings->load();
ExportWebDialog *dlg = new ExportWebDialog(settings, this);
connect(dlg, &ExportWebDialog::exportHTML,
this, &CalendarView::exportHTML);
dlg->show();
}
void CalendarView::exportICalendar()
{
QString filename =
......
......@@ -49,10 +49,6 @@ class KOViewManager;
class NavigatorBar;
class KOCheckableProxyModel;
class AkonadiCollectionView;
namespace KOrg
{
class HTMLExportSettings;
}
namespace CalendarSupport
{
......@@ -263,7 +259,6 @@ Q_SIGNALS:
void autoArchivingSettingsModified();
void newIncidenceChanger(Akonadi::IncidenceChanger *) Q_DECL_OVERRIDE;
void exportHTML(KOrg::HTMLExportSettings *);
void filtersUpdated(const QStringList &, int);
void filterChanged();
......@@ -490,9 +485,6 @@ public Q_SLOTS:
void print();
void printPreview();
/** Export as HTML file */
void exportWeb();
/** Export as iCalendar file */
void exportICalendar();
......
<!DOCTYPE kpartgui>
<kpartgui name="korganizer" version="427" translationDomain="korganizer">
<kpartgui name="korganizer" version="428" translationDomain="korganizer">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Merge/>
......@@ -16,7 +16,6 @@
<Action name="downloadnewstuff"/>
</Menu>
<Menu name="export"><text>&amp;Export</text>
<Action name="export_web" />
<Action name="export_icalendar"/>
<Action name="export_vcalendar"/>
<Merge/>
......
<!DOCTYPE kpartgui>
<kpartgui name="korganizer" version="429" translationDomain="korganizer">
<kpartgui name="korganizer" version="430" translationDomain="korganizer">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Menu name="import"><text>&amp;Import</text>
......@@ -10,7 +10,6 @@
<Action name="downloadnewstuff"/>
</Menu>
<Menu name="export"><text>&amp;Export</text>
<Action name="export_web" />
<Action name="export_icalendar"/>
<Action name="export_vcalendar"/>
<Merge/>
......
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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 "exportwebdialog.h"
#include "htmlexportsettings.h"
#include <KDateComboBox>
#include <QFileDialog>
#include <QHBoxLayout>
#include <KMessageBox>
#include <KUrlRequester>
#include <QVBoxLayout>
#include <KLocalizedString>
#include "korganizer_debug.h"
#include <QBoxLayout>
#include <QCheckBox>
#include <QGroupBox>
#include <QLabel>
// 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(KOrg::HTMLExportSettings *settings, QWidget *parent)
: KPageDialog(parent), KPIM::KPrefsWidManager(settings), mSettings(settings)
{
setAttribute(Qt::WA_DeleteOnClose);
setFaceType(Tabbed);
setWindowTitle(i18n("Export Calendar as Web Page"));
setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
setModal(false);
mExportButton = new QPushButton(i18n("Export"));
mExportButton->setDefault(true);
addActionButton(mExportButton);
setupGeneralPage();
setupEventPage();
setupTodoPage();
connect(mExportButton, &QPushButton::clicked, this, &ExportWebDialog::slotOk);
connect(button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &ExportWebDialog::reject);
connect(button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &ExportWebDialog::slotDefault);
readConfig();
updateState();
}
ExportWebDialog::~ExportWebDialog()
{
}
void ExportWebDialog::setDefaults()
{
setWidDefaults();
}
void ExportWebDialog::readConfig()
{
readWidConfig();
usrReadConfig();
}
void ExportWebDialog::writeConfig()
{
writeWidConfig();
usrWriteConfig();
readConfig();
}
void ExportWebDialog::slotApply()
{
writeConfig();
Q_EMIT configChanged();
}
void ExportWebDialog::slotOk()
{
slotApply();
Q_EMIT exportHTML(mSettings);
accept();
}
void ExportWebDialog::slotDefault()
{
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"),
KGuiItem(i18n("Reset to Defaults"))) == KMessageBox::Continue) {
setDefaults();
}
}
void ExportWebDialog::setupGeneralPage()
{
mGeneralPage = new QFrame(this);
addPage(mGeneralPage, i18nc("general settings for html export", "General"));
QVBoxLayout *topLayout = new QVBoxLayout(mGeneralPage);
topLayout->setSpacing(10);
mDateRangeGroup = new QGroupBox(i18n("Date Range"), mGeneralPage);
topLayout->addWidget(mDateRangeGroup);
QHBoxLayout *rangeLayout = new QHBoxLayout(mDateRangeGroup);
KPIM::KPrefsWidDate *dateStart = addWidDate(mSettings->dateStartItem());
rangeLayout->addWidget(dateStart->label());
rangeLayout->addWidget(dateStart->dateEdit());
KPIM::KPrefsWidDate *dateEnd = addWidDate(mSettings->dateEndItem());
rangeLayout->addWidget(dateEnd->label());
rangeLayout->addWidget(dateEnd->dateEdit());
QGroupBox *typeGroup = new QGroupBox(i18n("View Type"), mGeneralPage);
topLayout->addWidget(typeGroup);
QBoxLayout *typeLayout = new QVBoxLayout(typeGroup);
mMonthViewCheckBox = addWidBool(mSettings->monthViewItem())->checkBox();
connect(mMonthViewCheckBox, &QCheckBox::stateChanged, this, &ExportWebDialog::updateState);
typeLayout->addWidget(mMonthViewCheckBox);
mEventListCheckBox = addWidBool(mSettings->eventViewItem())->checkBox();
connect(mEventListCheckBox, &QCheckBox::stateChanged, this, &ExportWebDialog::updateState);
typeLayout->addWidget(mEventListCheckBox);
typeLayout->addWidget(addWidBool(mSettings->todoViewItem())->checkBox());
typeLayout->addWidget(
addWidBool(mSettings->excludePrivateItem())->checkBox());
typeLayout->addWidget(
addWidBool(mSettings->excludeConfidentialItem())->checkBox());
QGroupBox *destGroup = new QGroupBox(i18n("Destination"), mGeneralPage);
topLayout->addWidget(destGroup);
QBoxLayout *destLayout = new QHBoxLayout(destGroup);
KPIM::KPrefsWidPath *pathWid = addWidPath(mSettings->outputFileItem(),
destGroup, QStringLiteral("text/html"), KFile::File);
connect(pathWid->urlRequester(), &KUrlRequester::textChanged,