commit 973713f0ecf34181cfebe4878fd2ac4de04c5893
parent fa6c5447605a39b6c5f05664479c2aeac1d12bb4
Author: Oliver Lowe <o@olowe.co>
Date: Wed, 13 Aug 2025 18:48:53 +1000
Drop HTML address book export
It's XML already
Diffstat:
6 files changed, 2 insertions(+), 2015 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -32,9 +32,7 @@ abook_source = \
addrmerge.c \
editaddress.c \
editbook.c \
- editgroup.c \
- exphtmldlg.c \
- exporthtml.c
+ editgroup.c
abook_headers = \
adbookbase.h \
@@ -50,9 +48,7 @@ abook_headers = \
addrmerge.h \
editaddress.h \
editbook.h \
- editgroup.h \
- exphtmldlg.h \
- exporthtml.h
+ editgroup.h
claws_mail_SOURCES = \
account.c \
diff --git a/src/addressbook.c b/src/addressbook.c
@@ -70,7 +70,6 @@
#include "addrclip.h"
#include "addrgather.h"
#include "adbookbase.h"
-#include "exphtmldlg.h"
#include "addrcustomattr.h"
typedef enum
@@ -296,7 +295,6 @@ static void addressbook_list_select_remove ( AddrItemObject *aio );
static void addressbook_find_duplicates_cb ( GtkAction *action, gpointer data );
static void addressbook_edit_custom_attr_cb ( GtkAction *action, gpointer data );
-static void addressbook_export_html_cb ( GtkAction *action, gpointer data );
static void addressbook_select_all_cb ( GtkAction *action, gpointer data );
static void addressbook_clip_cut_cb ( GtkAction *action, gpointer data );
static void addressbook_clip_copy_cb ( GtkAction *action, gpointer data );
@@ -382,7 +380,6 @@ static GtkActionEntry addressbook_entries[] =
{"Address/Merge", NULL, N_("_Merge"), "<control>E", NULL, G_CALLBACK(addressbook_merge_cb) },
{"Tools/---", NULL, "---", NULL, NULL, NULL },
- {"Tools/ExportHTML", NULL, N_("Export _HTML..."), NULL, NULL, G_CALLBACK(addressbook_export_html_cb) },
{"Tools/FindDuplicates", NULL, N_("Find duplicates..."), NULL, NULL, G_CALLBACK(addressbook_find_duplicates_cb) },
{"Tools/EditAttrs", NULL, N_("Edit custom attributes..."), NULL, NULL, G_CALLBACK(addressbook_edit_custom_attr_cb) },
};
@@ -5037,30 +5034,6 @@ void addressbook_harvest(
}
}
-/**
- * Export HTML file.
- */
-static void addressbook_export_html_cb( GtkAction *action, gpointer data ) {
- GtkCMCTree *ctree = GTK_CMCTREE(addrbook.ctree);
- AddressObject *obj;
- AddressDataSource *ds = NULL;
- AddrBookBase *adbase;
- AddressCache *cache;
- GtkCMCTreeNode *node = NULL;
-
- if( ! addrbook.treeSelected ) return;
- node = addrbook.treeSelected;
- if( GTK_CMCTREE_ROW(node)->level == 1 ) return;
- obj = gtk_cmctree_node_get_row_data( ctree, node );
- if( obj == NULL ) return;
-
- ds = addressbook_find_datasource( node );
- if( ds == NULL ) return;
- adbase = ( AddrBookBase * ) ds->rawDataSource;
- cache = adbase->addressCache;
- addressbook_exp_html( cache );
-}
-
static void addressbook_find_duplicates_cb(GtkAction *action, gpointer data)
{
addrduplicates_find(GTK_WINDOW(addrbook.window));
diff --git a/src/exphtmldlg.c b/src/exphtmldlg.c
@@ -1,707 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2025 the Claws Mail team and Match Grun
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Export address book to HTML file.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#include "claws-features.h"
-#endif
-
-#include "defs.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "gtkutils.h"
-#include "prefs_common.h"
-#include "alertpanel.h"
-#include "mgutils.h"
-#include "addrcache.h"
-#include "addressitem.h"
-#include "exporthtml.h"
-#include "utils.h"
-#include "manage_window.h"
-#include "filesel.h"
-#include "combobox.h"
-
-#define PAGE_FILE_INFO 0
-#define PAGE_FORMAT 1
-#define PAGE_FINISH 2
-
-/**
- * Dialog object.
- */
-static struct _ExpHtml_Dlg {
- GtkWidget *window;
- GtkWidget *notebook;
- GtkWidget *labelBook;
- GtkWidget *entryHtml;
- GtkWidget *optmenuCSS;
- GtkWidget *optmenuName;
- GtkWidget *checkBanding;
- GtkWidget *checkLinkEMail;
- GtkWidget *checkAttributes;
- GtkWidget *labelOutBook;
- GtkWidget *labelOutFile;
- GtkWidget *btnPrev;
- GtkWidget *btnNext;
- GtkWidget *btnCancel;
- GtkWidget *statusbar;
- gint status_cid;
- gboolean cancelled;
-} exphtml_dlg;
-
-static struct _AddressFileSelection _exp_html_file_selector_;
-
-static ExportHtmlCtl *_exportCtl_ = NULL;
-static AddressCache *_addressCache_ = NULL;
-
-/**
- * Display message in status field.
- * \param msg Message to display.
- */
-static void export_html_status_show( gchar *msg ) {
- if( exphtml_dlg.statusbar != NULL ) {
- gtk_statusbar_pop(
- GTK_STATUSBAR(exphtml_dlg.statusbar),
- exphtml_dlg.status_cid );
- if( msg ) {
- gtk_statusbar_push(
- GTK_STATUSBAR(exphtml_dlg.statusbar),
- exphtml_dlg.status_cid, msg );
- }
- }
-}
-
-/**
- * Select and display status message appropriate for the page being displayed.
- */
-static void export_html_message( void ) {
- gchar *sMsg = NULL;
- gint pageNum;
-
- pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(exphtml_dlg.notebook) );
- if( pageNum == PAGE_FILE_INFO ) {
- sMsg = _( "Please specify output directory and file to create." );
- }
- else if( pageNum == PAGE_FORMAT ) {
- sMsg = _( "Select stylesheet and formatting." );
- }
- else if( pageNum == PAGE_FINISH ) {
- sMsg = _( "File exported successfully." );
- }
- export_html_status_show( sMsg );
-}
-
-/**
- * Callback function to cancel HTML file selection dialog.
- * \param widget Widget (button).
- * \param data User data.
- */
-static void export_html_cancel( GtkWidget *widget, gpointer data ) {
- gint pageNum;
-
- pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(exphtml_dlg.notebook) );
- if( pageNum != PAGE_FINISH ) {
- exphtml_dlg.cancelled = TRUE;
- }
- gtk_main_quit();
-}
-
-/**
- * Callback function to handle dialog close event.
- * \param widget Widget (dialog).
- * \param event Event object.
- * \param data User data.
- */
-static gint export_html_delete_event( GtkWidget *widget, GdkEventAny *event, gpointer data ) {
- export_html_cancel( widget, data );
- return TRUE;
-}
-
-/**
- * Callback function to respond to dialog key press events.
- * \param widget Widget.
- * \param event Event object.
- * \param data User data.
- */
-static gboolean export_html_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data ) {
- if (event && event->keyval == GDK_KEY_Escape) {
- export_html_cancel( widget, data );
- }
- return FALSE;
-}
-
-/**
- * Test whether we can move off file page.
- * \return <i>TRUE</i> if OK to move off page.
- */
-static gboolean exp_html_move_file( void ) {
- gchar *sFile, *msg, *reason;
- AlertValue aval;
-
- sFile = gtk_editable_get_chars( GTK_EDITABLE(exphtml_dlg.entryHtml), 0, -1 );
- g_strstrip( sFile );
- gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), sFile );
- exporthtml_parse_filespec( _exportCtl_, sFile );
- g_free( sFile );
-
- /* Test for directory */
- if( g_file_test(_exportCtl_->dirOutput,
- G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) {
- return TRUE;
- }
-
- /* Prompt to create */
- msg = g_strdup_printf( _(
- "The HTML output directory '%s'\n" \
- "does not exist. Do you want to create it?" ),
- _exportCtl_->dirOutput );
- aval = alertpanel(_("Create directory" ),
- msg, NULL, _("_No"), NULL, _("_Yes"), NULL, NULL,
- ALERTFOCUS_FIRST );
- g_free( msg );
- if( aval != G_ALERTALTERNATE ) return FALSE;
-
- /* Create directory */
- if( ! exporthtml_create_dir( _exportCtl_ ) ) {
- reason = exporthtml_get_create_msg( _exportCtl_ );
- msg = g_strdup_printf( _(
- "Could not create output directory for HTML file:\n%s" ),
- reason );
- aval = alertpanel_full(_("Failed to Create Directory"), msg,
- "window-close-symbolic", _("_Close"), NULL, NULL,
- NULL, NULL, ALERTFOCUS_FIRST, FALSE,
- NULL, ALERT_ERROR);
- g_free( msg );
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * Test whether we can move off format page.
- * \return <i>TRUE</i> if OK to move off page.
- */
-static gboolean exp_html_move_format( void ) {
- gboolean retVal = FALSE;
- gint id;
-
- /* Set stylesheet */
- id = combobox_get_active_data(GTK_COMBO_BOX(exphtml_dlg.optmenuCSS));
- exporthtml_set_stylesheet( _exportCtl_, id );
-
- /* Set name format */
- id = combobox_get_active_data(GTK_COMBO_BOX(exphtml_dlg.optmenuName));
- exporthtml_set_name_format( _exportCtl_, id );
-
- exporthtml_set_banding( _exportCtl_,
- gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON( exphtml_dlg.checkBanding ) ) );
- exporthtml_set_link_email( _exportCtl_,
- gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON( exphtml_dlg.checkLinkEMail ) ) );
- exporthtml_set_attributes( _exportCtl_,
- gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON( exphtml_dlg.checkAttributes ) ) );
-
- /* Process export */
- exporthtml_process( _exportCtl_, _addressCache_ );
- if( _exportCtl_->retVal == MGU_SUCCESS ) {
- retVal = TRUE;
- }
- else {
- export_html_status_show( _( "Error creating HTML file" ) );
- }
- return retVal;
-}
-
-/**
- * Display finish page.
- */
-static void exp_html_finish_show( void ) {
- gtk_label_set_text( GTK_LABEL(exphtml_dlg.labelOutFile), _exportCtl_->path );
- gtk_widget_set_sensitive( exphtml_dlg.btnNext, FALSE );
- gtk_widget_grab_focus( exphtml_dlg.btnCancel );
-}
-
-/**
- * Callback function to select previous page.
- * \param widget Widget (button).
- */
-static void export_html_prev( GtkWidget *widget ) {
- gint pageNum;
-
- pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(exphtml_dlg.notebook) );
- if( pageNum == PAGE_FORMAT ) {
- /* Goto file page stuff */
- gtk_notebook_set_current_page(
- GTK_NOTEBOOK(exphtml_dlg.notebook), PAGE_FILE_INFO );
- gtk_widget_set_sensitive( exphtml_dlg.btnPrev, FALSE );
- }
- else if( pageNum == PAGE_FINISH ) {
- /* Goto format page */
- gtk_notebook_set_current_page(
- GTK_NOTEBOOK(exphtml_dlg.notebook), PAGE_FORMAT );
- gtk_widget_set_sensitive( exphtml_dlg.btnNext, TRUE );
- }
- export_html_message();
-}
-
-/**
- * Callback function to select previous page.
- * \param widget Widget (button).
- */
-static void export_html_next( GtkWidget *widget ) {
- gint pageNum;
-
- pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(exphtml_dlg.notebook) );
- if( pageNum == PAGE_FILE_INFO ) {
- /* Goto format page */
- if( exp_html_move_file() ) {
- gtk_notebook_set_current_page(
- GTK_NOTEBOOK(exphtml_dlg.notebook), PAGE_FORMAT );
- gtk_widget_set_sensitive( exphtml_dlg.btnPrev, TRUE );
- }
- export_html_message();
- }
- else if( pageNum == PAGE_FORMAT ) {
- /* Goto finish page */
- if( exp_html_move_format() ) {
- gtk_notebook_set_current_page(
- GTK_NOTEBOOK(exphtml_dlg.notebook), PAGE_FINISH );
- gtk_button_set_label(GTK_BUTTON(exphtml_dlg.btnCancel),
- _("_Close"));
- gtk_button_set_image(GTK_BUTTON(exphtml_dlg.btnCancel),
- gtk_image_new_from_icon_name("window-close-symbolic", GTK_ICON_SIZE_BUTTON));
-
- exp_html_finish_show();
- exporthtml_save_settings( _exportCtl_ );
- export_html_message();
- }
- }
-}
-
-/**
- * Open file with web browser.
- * \param widget Widget (button).
- * \param data User data.
- */
-static void export_html_browse( GtkWidget *widget, gpointer data ) {
- gchar *uri;
-
- uri = g_filename_to_uri(_exportCtl_->path, NULL, NULL);
- open_uri( uri, prefs_common_get_uri_cmd() );
- g_free( uri );
-}
-
-/**
- * Create HTML file selection dialog.
- * \param afs Address file selection data.
- */
-static void exp_html_file_select_create( AddressFileSelection *afs ) {
- gchar *file = filesel_select_file_save(_("Select HTML output file"), NULL);
-
- if (file == NULL)
- afs->cancelled = TRUE;
- else {
- afs->cancelled = FALSE;
- gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), file );
- g_free(file);
- }
-}
-
-/**
- * Callback function to display HTML file selection dialog.
- */
-static void exp_html_file_select( void ) {
- exp_html_file_select_create( & _exp_html_file_selector_ );
-}
-
-/**
- * Format notebook file specification page.
- * \param pageNum Page (tab) number.
- * \param pageLbl Page (tab) label.
- */
-static void export_html_page_file( gint pageNum, gchar *pageLbl ) {
- GtkWidget *vbox;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *labelBook;
- GtkWidget *entryHtml;
- GtkWidget *btnFile;
-
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_add( GTK_CONTAINER( exphtml_dlg.notebook ), vbox );
- gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
-
- label = gtk_label_new( pageLbl );
- gtk_widget_show( label );
- gtk_notebook_set_tab_label(
- GTK_NOTEBOOK( exphtml_dlg.notebook ),
- gtk_notebook_get_nth_page(
- GTK_NOTEBOOK( exphtml_dlg.notebook ), pageNum ),
- label );
-
- table = gtk_grid_new();
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
- gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
- gtk_grid_set_row_spacing(GTK_GRID(table), 8);
- gtk_grid_set_column_spacing(GTK_GRID(table), 8);
-
- /* First row */
- label = gtk_label_new( _( "Address Book" ) );
- gtk_label_set_xalign(GTK_LABEL(label), 0.0);
- gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
-
- labelBook = gtk_label_new( "Address book name goes here" );
- gtk_label_set_xalign(GTK_LABEL(labelBook), 0.0);
- gtk_grid_attach(GTK_GRID(table), labelBook, 1, 0, 1, 1);
-
- /* Second row */
- label = gtk_label_new( _( "HTML Output File" ) );
- gtk_label_set_xalign(GTK_LABEL(label), 0.0);
- gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1);
-
- entryHtml = gtk_entry_new();
- gtk_grid_attach(GTK_GRID(table), entryHtml, 1, 1, 1, 1);
- gtk_widget_set_hexpand(entryHtml, TRUE);
- gtk_widget_set_halign(entryHtml, GTK_ALIGN_FILL);
-
- btnFile = gtkut_get_browse_file_btn(_("B_rowse"));
- gtk_grid_attach(GTK_GRID(table), btnFile, 2, 1, 1, 1);
-
- gtk_widget_show_all(vbox);
-
- /* Button handler */
- g_signal_connect(G_OBJECT(btnFile), "clicked",
- G_CALLBACK(exp_html_file_select), NULL);
-
- exphtml_dlg.labelBook = labelBook;
- exphtml_dlg.entryHtml = entryHtml;
-}
-
-/**
- * Format notebook format page.
- * \param pageNum Page (tab) number.
- * \param pageLbl Page (tab) label.
- */
-static void export_html_page_format( gint pageNum, gchar *pageLbl ) {
- GtkWidget *vbox;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *optmenuCSS;
- GtkWidget *optmenuName;
- GtkListStore *menu;
- GtkTreeIter iter;
- GtkWidget *checkBanding;
- GtkWidget *checkLinkEMail;
- GtkWidget *checkAttributes;
-
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_add( GTK_CONTAINER( exphtml_dlg.notebook ), vbox );
- gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
-
- label = gtk_label_new( pageLbl );
- gtk_widget_show( label );
- gtk_notebook_set_tab_label(
- GTK_NOTEBOOK( exphtml_dlg.notebook ),
- gtk_notebook_get_nth_page(
- GTK_NOTEBOOK( exphtml_dlg.notebook ), pageNum ),
- label );
-
- table = gtk_grid_new();
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
- gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
- gtk_grid_set_row_spacing(GTK_GRID(table), 8);
- gtk_grid_set_column_spacing(GTK_GRID(table), 8);
-
- /* First row */
- label = gtk_label_new( _( "Stylesheet" ) );
- gtk_label_set_xalign(GTK_LABEL(label), 0.0);
- gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
-
- optmenuCSS = gtkut_sc_combobox_create(NULL, TRUE);
- menu = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenuCSS)));
-
- COMBOBOX_ADD(menu, _("None"), EXPORT_HTML_ID_NONE);
- COMBOBOX_ADD(menu, _("Default"), EXPORT_HTML_ID_DEFAULT);
- COMBOBOX_ADD(menu, _("Full"), EXPORT_HTML_ID_FULL);
- COMBOBOX_ADD(menu, _("Custom"), EXPORT_HTML_ID_CUSTOM);
- COMBOBOX_ADD(menu, _("Custom-2"), EXPORT_HTML_ID_CUSTOM2);
- COMBOBOX_ADD(menu, _("Custom-3"), EXPORT_HTML_ID_CUSTOM3);
- COMBOBOX_ADD(menu, _("Custom-4"), EXPORT_HTML_ID_CUSTOM4);
-
- gtk_grid_attach(GTK_GRID(table), optmenuCSS, 1, 0, 1, 1);
-
- /* Second row */
- label = gtk_label_new( _( "Full Name Format" ) );
- gtk_label_set_xalign(GTK_LABEL(label), 0.0);
- gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1);
-
- optmenuName = gtkut_sc_combobox_create(NULL, TRUE);
- menu = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenuName)));
-
- COMBOBOX_ADD(menu, _("First Name, Last Name"), EXPORT_HTML_FIRST_LAST);
- COMBOBOX_ADD(menu, _("Last Name, First Name"), EXPORT_HTML_LAST_FIRST);
-
- gtk_grid_attach(GTK_GRID(table), optmenuName, 1, 1, 1, 1);
-
- /* Third row */
- checkBanding = gtk_check_button_new_with_label( _( "Color Banding" ) );
- gtk_grid_attach(GTK_GRID(table), checkBanding, 1, 2, 1, 1);
-
- /* Fourth row */
- checkLinkEMail = gtk_check_button_new_with_label( _( "Format Email Links" ) );
- gtk_grid_attach(GTK_GRID(table), checkLinkEMail, 1, 3, 1, 1);
-
- /* Fifth row */
- checkAttributes = gtk_check_button_new_with_label( _( "Format User Attributes" ) );
- gtk_grid_attach(GTK_GRID(table), checkAttributes, 1, 4, 1, 1);
-
- gtk_widget_show_all(vbox);
-
- exphtml_dlg.optmenuCSS = optmenuCSS;
- exphtml_dlg.optmenuName = optmenuName;
- exphtml_dlg.checkBanding = checkBanding;
- exphtml_dlg.checkLinkEMail = checkLinkEMail;
- exphtml_dlg.checkAttributes = checkAttributes;
-}
-
-/**
- * Format notebook finish page.
- * \param pageNum Page (tab) number.
- * \param pageLbl Page (tab) label.
- */
-static void export_html_page_finish( gint pageNum, gchar *pageLbl ) {
- GtkWidget *vbox;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *labelBook;
- GtkWidget *labelFile;
- GtkWidget *btnBrowse;
-
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
- gtk_container_add( GTK_CONTAINER( exphtml_dlg.notebook ), vbox );
- gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
-
- label = gtk_label_new( pageLbl );
- gtk_widget_show( label );
- gtk_notebook_set_tab_label(
- GTK_NOTEBOOK( exphtml_dlg.notebook ),
- gtk_notebook_get_nth_page( GTK_NOTEBOOK( exphtml_dlg.notebook ), pageNum ), label );
-
- table = gtk_grid_new();
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
- gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
- gtk_grid_set_row_spacing(GTK_GRID(table), 8);
- gtk_grid_set_column_spacing(GTK_GRID(table), 8);
-
- /* First row */
- label = gtk_label_new( _( "Address Book:" ) );
- gtk_label_set_xalign(GTK_LABEL(label), 1.0);
- gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
-
- labelBook = gtk_label_new("Full name of address book goes here");
- gtk_label_set_xalign(GTK_LABEL(labelBook), 0.0);
- gtk_grid_attach(GTK_GRID(table), labelBook, 1, 0, 1, 1);
-
- /* Second row */
- label = gtk_label_new( _( "File Name:" ) );
- gtk_label_set_xalign(GTK_LABEL(label), 1.0);
- gtk_grid_attach(GTK_GRID(table), label, 0, 1, 1, 1);
-
- labelFile = gtk_label_new("File name goes here");
- gtk_label_set_xalign(GTK_LABEL(labelFile), 0.0);
- gtk_grid_attach(GTK_GRID(table), labelFile, 1, 1, 1, 1);
-
- /* Third row */
- btnBrowse = gtk_button_new_with_label( _( "Open with Web Browser" ) );
- gtk_grid_attach(GTK_GRID(table), btnBrowse, 1, 2, 1, 1);
-
- gtk_widget_show_all(vbox);
-
- /* Button handlers */
- g_signal_connect(G_OBJECT(btnBrowse), "clicked",
- G_CALLBACK(export_html_browse), NULL);
-
- exphtml_dlg.labelOutBook = labelBook;
- exphtml_dlg.labelOutFile = labelFile;
-}
-
-/**
- * Create main dialog decorations (excluding notebook pages).
- */
-static void export_html_dialog_create( void ) {
- GtkWidget *window;
- GtkWidget *vbox;
- GtkWidget *vnbox;
- GtkWidget *notebook;
- GtkWidget *hbbox;
- GtkWidget *btnPrev;
- GtkWidget *btnNext;
- GtkWidget *btnCancel;
- GtkWidget *hsbox;
- GtkWidget *statusbar;
-
- window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "exphtmldlg");
- gtk_widget_set_size_request(window, -1, -1 );
- gtk_container_set_border_width( GTK_CONTAINER(window), 0 );
- gtk_window_set_title( GTK_WINDOW(window),
- _("Export Address Book to HTML File") );
- gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
- gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
- g_signal_connect(G_OBJECT(window), "delete_event",
- G_CALLBACK(export_html_delete_event),
- NULL );
- g_signal_connect(G_OBJECT(window), "key_press_event",
- G_CALLBACK(export_html_key_pressed),
- NULL );
-
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_widget_show(vbox);
- gtk_container_add(GTK_CONTAINER(window), vbox);
-
- vnbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4);
- gtk_widget_show(vnbox);
- gtk_box_pack_start(GTK_BOX(vbox), vnbox, TRUE, TRUE, 0);
-
- /* Notebook */
- notebook = gtk_notebook_new();
- gtk_notebook_set_show_tabs( GTK_NOTEBOOK(notebook), FALSE ); /* Hide */
- /* gtk_notebook_set_show_tabs( GTK_NOTEBOOK(notebook), TRUE ); */
- gtk_widget_show(notebook);
- gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(notebook), 6);
-
- /* Status line */
- hsbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH);
- statusbar = gtk_statusbar_new();
- gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
-
- /* Button panel */
- gtkut_stock_button_set_create(&hbbox, &btnPrev, "go-previous", _("_Previous"),
- &btnNext, "go-next", _("_Next"),
- &btnCancel, NULL, _("_Cancel"));
- gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2);
- gtk_widget_grab_default(btnNext);
-
- /* Button handlers */
- g_signal_connect(G_OBJECT(btnPrev), "clicked",
- G_CALLBACK(export_html_prev), NULL);
- g_signal_connect(G_OBJECT(btnNext), "clicked",
- G_CALLBACK(export_html_next), NULL);
- g_signal_connect(G_OBJECT(btnCancel), "clicked",
- G_CALLBACK(export_html_cancel), NULL);
-
- gtk_widget_show_all(vbox);
-
- exphtml_dlg.window = window;
- exphtml_dlg.notebook = notebook;
- exphtml_dlg.btnPrev = btnPrev;
- exphtml_dlg.btnNext = btnNext;
- exphtml_dlg.btnCancel = btnCancel;
- exphtml_dlg.statusbar = statusbar;
- exphtml_dlg.status_cid = gtk_statusbar_get_context_id(
- GTK_STATUSBAR(statusbar), "Export HTML Dialog" );
-}
-
-/**
- * Create export HTML dialog.
- */
-static void export_html_create( void ) {
- export_html_dialog_create();
- export_html_page_file( PAGE_FILE_INFO, _( "File Info" ) );
- export_html_page_format( PAGE_FORMAT, _( "Format" ) );
- export_html_page_finish( PAGE_FINISH, _( "Finish" ) );
- gtk_widget_show_all( exphtml_dlg.window );
-}
-
-/**
- * Populate fields from control data.
- * \param ctl Export control data.
- */
-static void export_html_fill_fields( ExportHtmlCtl *ctl ) {
- gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), "" );
- if( ctl->path ) {
- gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml),
- ctl->path );
- }
-
- combobox_select_by_data(
- GTK_COMBO_BOX(exphtml_dlg.optmenuCSS), ctl->stylesheet );
- combobox_select_by_data(
- GTK_COMBO_BOX(exphtml_dlg.optmenuName), ctl->nameFormat );
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON( exphtml_dlg.checkBanding ), ctl->banding );
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON( exphtml_dlg.checkLinkEMail ), ctl->linkEMail );
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON( exphtml_dlg.checkAttributes ), ctl->showAttribs );
-}
-
-/**
- * Process export address dialog.
- * \param cache Address book/data source cache.
- */
-void addressbook_exp_html( AddressCache *cache ) {
- /* Set references to control data */
- _addressCache_ = cache;
-
- _exportCtl_ = exporthtml_create();
- exporthtml_load_settings( _exportCtl_ );
-
- /* Setup GUI */
- if( ! exphtml_dlg.window )
- export_html_create();
-
- gtk_button_set_label(GTK_BUTTON(exphtml_dlg.btnCancel),
- _("_Cancel"));
- exphtml_dlg.cancelled = FALSE;
- gtk_widget_show(exphtml_dlg.window);
- manage_window_set_transient(GTK_WINDOW(exphtml_dlg.window));
- gtk_window_set_modal(GTK_WINDOW(exphtml_dlg.window), TRUE);
- gtk_label_set_text( GTK_LABEL(exphtml_dlg.labelBook), cache->name );
- gtk_label_set_text( GTK_LABEL(exphtml_dlg.labelOutBook), cache->name );
- export_html_fill_fields( _exportCtl_ );
-
- gtk_widget_grab_default(exphtml_dlg.btnNext);
- gtk_notebook_set_current_page( GTK_NOTEBOOK(exphtml_dlg.notebook), PAGE_FILE_INFO );
- gtk_widget_set_sensitive( exphtml_dlg.btnPrev, FALSE );
- gtk_widget_set_sensitive( exphtml_dlg.btnNext, TRUE );
-
- export_html_message();
- gtk_widget_grab_focus(exphtml_dlg.entryHtml);
-
- gtk_main();
- gtk_widget_hide(exphtml_dlg.window);
- gtk_window_set_modal(GTK_WINDOW(exphtml_dlg.window), FALSE);
- exporthtml_free( _exportCtl_ );
- _exportCtl_ = NULL;
-
- _addressCache_ = NULL;
-}
diff --git a/src/exphtmldlg.h b/src/exphtmldlg.h
@@ -1,30 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 Match Grun and the Claws Mail team
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Export addressbook to HTML file.
- */
-
-#ifndef __EXPORT_HTML_H__
-#define __EXPORT_HTML_H__
-
-/* Function prototypes */
-void addressbook_exp_html( AddressCache *cache );
-
-#endif /* __EXPORT_HTML_H__ */
diff --git a/src/exporthtml.c b/src/exporthtml.c
@@ -1,1160 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2024 the Claws Mail team and Match Grun
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Export address book to HTML file.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#include "claws-features.h"
-#endif
-
-#include <sys/stat.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "mgutils.h"
-#include "utils.h"
-#include "exporthtml.h"
-#include "xmlprops.h"
-#include "file-utils.h"
-
-#define DFL_DIR_CLAWS_OUT "claws-mail-out"
-#define DFL_FILE_CLAWS_OUT "addressbook.html"
-
-#define FMT_BUFSIZE 2048
-#define SC_HTML_SPACE " "
-#define BORDER_SIZE 2
-#define CELL_PADDING 2
-#define CELL_SPACING 2
-#define CHAR_ENCODING "UTF-8"
-
-/* Stylesheet names */
-#define FILENAME_NONE ""
-#define FILENAME_DEFAULT "claws-mail.css"
-#define FILENAME_FULL "full.css"
-#define FILENAME_CUSTOM "custom.css"
-#define FILENAME_CUSTOM2 "custom2.css"
-#define FILENAME_CUSTOM3 "custom3.css"
-#define FILENAME_CUSTOM4 "custom4.css"
-
-/* Settings - properties */
-#define EXML_PROPFILE_NAME "exporthtml.xml"
-#define EXMLPROP_DIRECTORY "directory"
-#define EXMLPROP_FILE "file"
-#define EXMLPROP_STYLESHEET "stylesheet"
-#define EXMLPROP_FMT_NAME "format-full-name"
-#define EXMLPROP_FMT_EMAIL "format-email-links"
-#define EXMLPROP_FMT_ATTRIB "format-attributes"
-#define EXMLPROP_BANDING "color-banding"
-#define EXMLPROP_VALUE_YES "y"
-#define EXMLPROP_VALUE_NO "n"
-
-static gchar *_idTagRowEven_ = "tab-row0";
-static gchar *_idTagRowOdd_ = "tab-row1";
-
-/*
- * Header entry.
- */
-typedef struct _StylesheetEntry StylesheetEntry;
-struct _StylesheetEntry {
- gchar *fileName;
- gint id;
- gboolean dflValue;
-};
-
-/*
- * Build stylesheet entry.
- * Enter: ctl Export control data.
- * file Filename.
- * id File id.
- * dfl Default flag.
- */
-static void exporthtml_build_entry(
- ExportHtmlCtl *ctl, const gchar *file, const gint id,
- const gboolean dfl )
-{
- StylesheetEntry *entry;
-
- entry = g_new0( StylesheetEntry, 1 );
- entry->fileName = g_strdup( file );
- entry->id = id;
- entry->dflValue = dfl;
- ctl->listStyle = g_list_append( ctl->listStyle, entry );
-}
-
-/*
- * Free up object by releasing internal memory.
- * Enter: ctl Export control data.
- */
-ExportHtmlCtl *exporthtml_create( void ) {
- ExportHtmlCtl *ctl = g_new0( ExportHtmlCtl, 1 );
-
- ctl->path = NULL;
- ctl->dirOutput = NULL;
- ctl->fileHtml = NULL;
- ctl->encoding = g_strconcat(CHAR_ENCODING, NULL);
- ctl->stylesheet = EXPORT_HTML_ID_NONE;
- ctl->nameFormat = EXPORT_HTML_FIRST_LAST;
- ctl->banding = FALSE;
- ctl->linkEMail = FALSE;
- ctl->showAttribs = FALSE;
- ctl->retVal = MGU_SUCCESS;
- ctl->listStyle = NULL;
- ctl->rcCreate = 0;
- ctl->settingsFile = g_strconcat(
- get_rc_dir(), G_DIR_SEPARATOR_S, EXML_PROPFILE_NAME, NULL );
-
- /* Build stylesheet list */
- exporthtml_build_entry(
- ctl, FILENAME_NONE, EXPORT_HTML_ID_NONE, FALSE );
- exporthtml_build_entry(
- ctl, FILENAME_DEFAULT, EXPORT_HTML_ID_DEFAULT, TRUE );
- exporthtml_build_entry(
- ctl, FILENAME_FULL, EXPORT_HTML_ID_FULL, FALSE );
- exporthtml_build_entry(
- ctl, FILENAME_CUSTOM, EXPORT_HTML_ID_CUSTOM, FALSE );
- exporthtml_build_entry(
- ctl, FILENAME_CUSTOM2, EXPORT_HTML_ID_CUSTOM2, FALSE );
- exporthtml_build_entry(
- ctl, FILENAME_CUSTOM3, EXPORT_HTML_ID_CUSTOM3, FALSE );
- exporthtml_build_entry(
- ctl, FILENAME_CUSTOM4, EXPORT_HTML_ID_CUSTOM4, FALSE );
-
- return ctl;
-}
-
-/*
- * Free up object by releasing internal memory.
- * Enter: ctl Export control data.
- */
-void exporthtml_free( ExportHtmlCtl *ctl ) {
- GList *node;
- StylesheetEntry *entry;
-
- cm_return_if_fail( ctl != NULL );
-
- /* Free stylesheet list */
- node = ctl->listStyle;
- while( node ) {
- entry = ( StylesheetEntry * ) node->data;
- g_free( entry->fileName );
- entry->fileName = NULL;
- entry->id = 0;
- entry->dflValue = FALSE;
- g_free( entry );
- node->data = NULL;
- node = g_list_next( node );
- }
- g_list_free( ctl->listStyle );
- ctl->listStyle = NULL;
-
- g_free( ctl->path );
- g_free( ctl->fileHtml );
- g_free( ctl->encoding );
- g_free( ctl->dirOutput );
- g_free( ctl->settingsFile );
-
- /* Clear pointers */
- ctl->path = NULL;
- ctl->dirOutput = NULL;
- ctl->fileHtml = NULL;
- ctl->encoding = NULL;
- ctl->stylesheet = EXPORT_HTML_ID_NONE;
- ctl->nameFormat = EXPORT_HTML_FIRST_LAST;
- ctl->banding = FALSE;
- ctl->linkEMail = FALSE;
- ctl->showAttribs = FALSE;
- ctl->retVal = MGU_SUCCESS;
- ctl->rcCreate = 0;
-
- /* Now release object */
- g_free( ctl );
-}
-
-/*
- * Find style entry.
- * Enter: ctl Export control data.
- * Return: Stylesheet object, or NULL if nothing found. If a default entry is
- * found in list, it will be returned.
- */
-static StylesheetEntry *exporthtml_find_stylesheet( ExportHtmlCtl *ctl ) {
- StylesheetEntry *retVal = NULL;
- StylesheetEntry *entry;
- GList *node;
-
- node = ctl->listStyle;
- while( node ) {
- entry = ( StylesheetEntry * ) node->data;
- if( entry->id == ctl->stylesheet ) return entry;
- if( entry->dflValue ) retVal = entry;
- node = g_list_next( node );
- }
- return retVal;
-}
-
-void exporthtml_set_stylesheet( ExportHtmlCtl *ctl, const gint value ) {
- cm_return_if_fail( ctl != NULL );
- ctl->stylesheet = value;
-}
-void exporthtml_set_name_format( ExportHtmlCtl *ctl, const gint value ) {
- cm_return_if_fail( ctl != NULL );
- ctl->nameFormat = value;
-}
-void exporthtml_set_banding( ExportHtmlCtl *ctl, const gboolean value ) {
- cm_return_if_fail( ctl != NULL );
- ctl->banding = value;
-}
-void exporthtml_set_link_email( ExportHtmlCtl *ctl, const gboolean value ) {
- cm_return_if_fail( ctl != NULL );
- ctl->linkEMail = value;
-}
-void exporthtml_set_attributes( ExportHtmlCtl *ctl, const gboolean value ) {
- cm_return_if_fail( ctl != NULL );
- ctl->showAttribs = value;
-}
-
-/*
- * Create default CSS file.
- * Enter: fileSpec File to create.
- * Return: Status code.
- */
-static gint exporthtml_create_css_dfl( const gchar *fileSpec ) {
- FILE *cssFile;
-
- cssFile = g_fopen( fileSpec, "rb" );
- if( cssFile ) {
- fclose( cssFile );
- return MGU_SUCCESS;
- }
- cssFile = g_fopen( fileSpec, "wb" );
- if( ! cssFile ) {
- return MGU_OPEN_FILE;
- }
-
- fprintf( cssFile, "body {\n\tbackground: #ffffe0;\n" );
- fprintf( cssFile, "\tfont-family: lucida, helvetica, sans-serif;\n" );
- fprintf( cssFile, "\tfont-size: 10pt;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, "h1 {\n" );
- fprintf( cssFile, "\tcolor: #000000;\n" );
- fprintf( cssFile, "\ttext-align: center;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, "th {\n" );
- fprintf( cssFile, "\tfont-size: 10pt;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, "td {\n" );
- fprintf( cssFile, "\tfont-size: 10pt;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".fmt-folder {\n" );
- fprintf( cssFile, "\tcolor: #0000ff;\n" );
- fprintf( cssFile, "\tfont-size: 18pt;\n" );
- fprintf( cssFile, "\tfont-weight: bold;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-head {\n" );
- fprintf( cssFile, "\tbackground: #80c0f0;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-dn {\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-addr {\n" );
- fprintf( cssFile, "\tfont-style: italic;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-email {\n" );
- fprintf( cssFile, "\tfont-weight: bold;\n" );
- fprintf( cssFile, "\tfont-style: italic;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-fn {\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-attr {\n" );
- fprintf( cssFile, "}\n" );
-
- safe_fclose( cssFile );
- return MGU_SUCCESS;
-}
-
-/*
- * Create full CSS file.
- * Enter: fileSpec File to create.
- * Return: Status code.
- */
-static gint exporthtml_create_css_full( const gchar *fileSpec ) {
- FILE *cssFile;
-
- cssFile = g_fopen( fileSpec, "rb" );
- if( cssFile ) {
- fclose( cssFile );
- return MGU_SUCCESS;
- }
- cssFile = g_fopen( fileSpec, "wb" );
- if( ! cssFile ) {
- return MGU_OPEN_FILE;
- }
-
- fprintf( cssFile, "body {\n\tbackground: #ffffe0;\n" );
- fprintf( cssFile, "\tfont-family: lucida, helvetica, sans-serif;\n" );
- fprintf( cssFile, "\tfont-size: 10pt;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, "h1 {\n" );
- fprintf( cssFile, "\tcolor: #000000;\n" );
- fprintf( cssFile, "\ttext-align: center;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, "th {\n" );
- fprintf( cssFile, "\tfont-size: 10pt;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, "td {\n" );
- fprintf( cssFile, "\tfont-size: 10pt;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".fmt-folder {\n" );
- fprintf( cssFile, "\tcolor: #0000ff;\n" );
- fprintf( cssFile, "\tfont-size: 18pt;\n" );
- fprintf( cssFile, "\tfont-weight: bold;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-head {\n" );
- fprintf( cssFile, "\tbackground: #80c0f0;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-row0 {\n" );
- fprintf( cssFile, "\tbackground: #f0f0f0;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-row1 {\n" );
- fprintf( cssFile, "\tbackground: #d0d0d0;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-dn {\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-addr {\n" );
- fprintf( cssFile, "\tfont-style: italic;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-email {\n" );
- fprintf( cssFile, "\tfont-weight: bold;\n" );
- fprintf( cssFile, "\tfont-style: italic;\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-fn {\n" );
- fprintf( cssFile, "}\n" );
- fprintf( cssFile, ".tab-attr {\n" );
- fprintf( cssFile, "}\n" );
-
- safe_fclose( cssFile );
- return MGU_SUCCESS;
-}
-
-/*
- * Create stylesheet files.
- * Enter: ctl Export control data.
- */
-static void exporthtml_create_css_files( ExportHtmlCtl *ctl ) {
- gchar *fileSpec;
- GList *node;
-
- node = ctl->listStyle;
- while( node ) {
- StylesheetEntry *entry = node->data;
- node = g_list_next( node );
- if( strlen( entry->fileName ) ) {
- fileSpec = g_strconcat(
- ctl->dirOutput, G_DIR_SEPARATOR_S,
- entry->fileName, NULL );
- if( entry->id == EXPORT_HTML_ID_DEFAULT ) {
- exporthtml_create_css_dfl( fileSpec );
- }
- else if( entry->id != EXPORT_HTML_ID_NONE ) {
- exporthtml_create_css_full( fileSpec );
- }
- g_free( fileSpec );
- }
- }
-}
-
-/*
- * Comparison using linked list elements.
- */
-static gint exporthtml_compare_name(
- gconstpointer ptr1, gconstpointer ptr2 )
-{
- const AddrItemObject *item1 = ptr1;
- const AddrItemObject *item2 = ptr2;
- const gchar *name1 = NULL, *name2 = NULL;
- if( item1 ) name1 = ADDRITEM_NAME( item1 );
- if( item2 ) name2 = ADDRITEM_NAME( item2 );
- if( ! name1 ) return ( name2 != NULL );
- if( ! name2 ) return -1;
- return g_utf8_collate( name1, name2 );
-}
-
-/*
- * Comparison using linked list elements.
- */
-static gint exporthtml_compare_email(
- gconstpointer ptr1, gconstpointer ptr2 )
-{
- const ItemEMail *email1 = ptr1;
- const ItemEMail *email2 = ptr2;
- const gchar *name1 = NULL, *name2 = NULL;
- if( email1 ) name1 = email1->address;
- if( email2 ) name2 = email2->address;
- if( ! name1 ) return ( name2 != NULL );
- if( ! name2 ) return -1;
- return g_utf8_collate( name1, name2 );
-}
-
-/*
- * Comparison using linked list elements.
- */
-static gint exporthtml_compare_attrib(
- gconstpointer ptr1, gconstpointer ptr2 )
-{
- const UserAttribute *attr1 = ptr1;
- const UserAttribute *attr2 = ptr2;
- const gchar *name1 = NULL, *name2 = NULL;
- if( attr1 ) name1 = attr1->name;
- if( attr2 ) name2 = attr2->name;
- if( ! name1 ) return ( name2 != NULL );
- if( ! name2 ) return -1;
- return g_utf8_collate( name1, name2 );
-}
-
-/*
- * Build sorted list of named items.
- * Enter: list List of items to sorted.
- * Return: Sorted list.
- * Note: List should freed after use. Items referenced by list should not be
- * freed since they are managed by the address cache.
- */
-static GList *exporthtml_sort_name( const GList *list ) {
- const GList *node;
- GList *sorted = NULL;
-
- node = list;
- while( node ) {
- sorted = g_list_insert_sorted(
- sorted, node->data, exporthtml_compare_name );
- node = g_list_next( node );
- }
- return sorted;
-}
-
-/*
- * Build sorted list of email items.
- * Enter: list List of E-Mail items to sorted.
- * Return: Sorted list.
- * Note: List should freed after use. Items referenced by list should not be
- * freed since they are managed by the address cache.
- */
-static GList *exporthtml_sort_email( const GList *list ) {
- const GList *node;
- GList *sorted = NULL;
-
- node = list;
- while( node ) {
- sorted = g_list_insert_sorted(
- sorted, node->data, exporthtml_compare_email );
- node = g_list_next( node );
- }
- return sorted;
-}
-
-/*
- * Build sorted list of attributes.
- * Enter: list List of items to sorted.
- * Return: Sorted list.
- * Note: List should freed after use. Items referenced by list should not be
- * freed since they are managed by the address cache.
- */
-static GList *exporthtml_sort_attrib( const GList *list ) {
- const GList *node;
- GList *sorted = NULL;
-
- sorted = NULL;
- node = list;
- while( node ) {
- sorted = g_list_insert_sorted(
- sorted, node->data, exporthtml_compare_attrib );
- node = g_list_next( node );
- }
- return sorted;
-}
-
-/*
- * Format a list of E-Mail addresses.
- * Enter: ctl Export control data.
- * stream Output stream.
- * listEMail List of addresses.
- * sortFlag Set to TRUE if address list should be sorted.
- */
-static void exporthtml_fmt_email(
- ExportHtmlCtl *ctl, FILE *stream, const GList *listEMail,
- gboolean sortFlag )
-{
- const GList *node;
- GList *list;
- gchar *name;
-
- if( listEMail == NULL ) {
- fprintf( stream, SC_HTML_SPACE );
- return;
- }
-
- list = NULL;
- if( sortFlag ) {
- node = list = exporthtml_sort_email( listEMail );
- }
- else {
- node = listEMail;
- }
-
- while( node ) {
- ItemEMail *email = ( ItemEMail * ) node->data;
- node = g_list_next( node );
-
- name = ADDRITEM_NAME( email );
- if( name ) {
- fprintf( stream, "%s ", name );
- }
- if( ctl->linkEMail ) {
- fprintf( stream, "<a href=\"mailto:%s\">",
- email->address );
- }
- fprintf( stream, "<span class=\"tab-email\">" );
- fprintf( stream, "%s", email->address );
- fprintf( stream, "</span>" );
- if( ctl->linkEMail ) {
- fprintf( stream, "</a>" );
- }
- if( email->remarks ) {
- if( strlen( email->remarks ) ) {
- fprintf( stream, " (%s)", email->remarks );
- }
- }
- fprintf( stream, "<br>\n" );
- }
- g_list_free( list );
-}
-
-/*
- * Format groups in an address book folder.
- * Enter: ctl Export control data.
- * stream Output stream.
- * folder Folder.
- * prevFlag If FALSE, list of persons were output.
- * Return: TRUE if no groups were formatted.
- */
-static gboolean exporthtml_fmt_group(
- ExportHtmlCtl *ctl, FILE *stream, const ItemFolder *folder,
- gboolean prevFlag )
-{
- gboolean retVal, band;
- GList *node, *list;
- const gchar *tagName;
-
- retVal = TRUE;
- if( folder->listGroup == NULL ) return retVal;
-
- /* Write separator */
- if( ! prevFlag ) {
- fprintf( stream, "<br>\n" );
- }
-
- /* Write table headers */
- fprintf( stream, "<table" );
- fprintf( stream, " border=\"%d\"", BORDER_SIZE );
- fprintf( stream, " cellpadding=\"%d\"", CELL_PADDING );
- fprintf( stream, " cellspacing=\"%d\"", CELL_SPACING );
- fprintf( stream, ">\n" );
-
- fprintf( stream, "<tr class=\"tab-head\">\n" );
- fprintf( stream, " <th width=\"200\">" );
- fprintf( stream, "%s", _( "Group Name" ) );
- fprintf( stream, "</th>\n" );
- fprintf( stream, " <th width=\"300\">" );
- fprintf( stream, "%s", _( "Email Address" ) );
- fprintf( stream, "</th>\n" );
- fprintf( stream, "</tr>\n" );
- list = exporthtml_sort_name( folder->listGroup );
-
- band = FALSE;
- node = list;
- while( node ) {
- AddrItemObject *aio = node->data;
- if( aio && aio->type == ITEMTYPE_GROUP ) {
- ItemGroup *group = ( ItemGroup * ) aio;
-
- fprintf( stream, "<tr valign=\"top\"" );
- if( ctl->banding ) {
- if( band ) {
- tagName = _idTagRowOdd_;
- }
- else {
- tagName = _idTagRowEven_;
- }
- fprintf( stream, " class=\"%s\"", tagName );
- band = ! band;
- }
- fprintf( stream, "\">\n" );
-
- fprintf( stream, " <td class=\"tab-dn\">" );
- fprintf( stream, "%s", ADDRITEM_NAME( group ) );
- fprintf( stream, "</td>\n" );
- fprintf( stream, " <td class=\"tab-addr\">" );
- exporthtml_fmt_email( ctl, stream, group->listEMail, TRUE );
- fprintf( stream, "</td>\n" );
- fprintf( stream, "</tr>\n" );
- retVal = FALSE;
- }
- node = g_list_next( node );
- }
-
- g_list_free( list );
- fprintf( stream, "</table>\n" );
- return retVal;
-}
-
-/*
- * Format a list of E-Mail addresses.
- * Enter: ctl Export control data.
- * stream Output stream.
- * listAttr List of attributes.
- */
-static void exporthtml_fmt_attribs(
- ExportHtmlCtl *ctl, FILE *stream, const GList *listAttr )
-{
- const GList *node;
- GList *list;
-
- if( listAttr == NULL ) {
- fprintf( stream, SC_HTML_SPACE );
- return;
- }
-
- fprintf( stream, "<table border=\"0\">\n" );
- node = list = exporthtml_sort_attrib( listAttr );
- while( node ) {
- UserAttribute *attr = ( UserAttribute * ) node->data;
- node = g_list_next( node );
- fprintf( stream, "<tr valign=\"top\">" );
- fprintf( stream, "<td align=\"right\">%s:</td>", attr->name );
- fprintf( stream, "<td>%s</td>", attr->value );
- fprintf( stream, "</tr>\n" );
- }
-
- g_list_free( list );
- fprintf( stream, "</table>" );
-}
-
-/*
- * Format full name.
- * Enter: ctl Export control data.
- * buf Output buffer.
- * person Person to format.
- */
-static void exporthtml_fmt_fullname(
- ExportHtmlCtl *ctl, gchar *buf, const ItemPerson *person )
-{
- gboolean flag;
-
- if( ctl->nameFormat == EXPORT_HTML_LAST_FIRST ) {
- flag = FALSE;
- if( person->lastName ) {
- if( *person->lastName ) {
- strcat( buf, " " );
- strcat( buf, person->lastName );
- flag = TRUE;
- }
- }
- if( person->firstName ) {
- if( *person->firstName ) {
- if( flag ) {
- strcat( buf, ", " );
- }
- strcat( buf, person->firstName );
- }
- }
- }
- else {
- if( person->firstName ) {
- if( *person->firstName ) {
- strcat( buf, person->firstName );
- }
- }
- if( person->lastName ) {
- if( *person->lastName ) {
- strcat( buf, " " );
- strcat( buf, person->lastName );
- }
- }
- }
- g_strstrip( buf );
-
- flag = FALSE;
- if( *buf ) flag = TRUE;
- if( person->nickName ) {
- if( strlen( person->nickName ) ) {
- if( flag ) {
- strcat( buf, " (" );
- }
- strcat( buf, person->nickName );
- if( flag ) {
- strcat( buf, ")" );
- }
- }
- }
- g_strstrip( buf );
-}
-
-/*
- * Format persons in an address book folder.
- * Enter: ctl Export control data.
- * stream Output stream.
- * folder Folder.
- * Return: TRUE if no persons were formatted.
- */
-static gboolean exporthtml_fmt_person(
- ExportHtmlCtl *ctl, FILE *stream, const ItemFolder *folder )
-{
- gboolean retVal, band;
- GList *node, *list;
- gchar buf[ FMT_BUFSIZE ];
- const gchar *tagName;
-
- retVal = TRUE;
- if( folder->listPerson == NULL ) return retVal;
-
- /* Write table headers */
- fprintf( stream, "<table" );
- fprintf( stream, " border=\"%d\"", BORDER_SIZE );
- fprintf( stream, " cellpadding=\"%d\"", CELL_PADDING );
- fprintf( stream, " cellspacing=\"%d\"", CELL_SPACING );
- fprintf( stream, ">\n" );
-
- fprintf( stream, "<tr class=\"tab-head\">\n" );
- fprintf( stream, " <th width=\"200\">" );
- fprintf( stream, "%s", _( "Display Name" ) );
- fprintf( stream, "</th>\n" );
- fprintf( stream, " <th width=\"300\">" );
- fprintf( stream, "%s", _( "Email Address" ) );
- fprintf( stream, "</th>\n" );
- fprintf( stream, " <th width=\"200\">" );
- fprintf( stream, "%s", _( "Full Name" ) );
- fprintf( stream, "</th>\n" );
- if( ctl->showAttribs ) {
- fprintf( stream, " <th width=\"250\">" );
- fprintf( stream, "%s", _( "Attributes" ) );
- fprintf( stream, "</th>\n" );
- }
- fprintf( stream, "</tr>\n" );
-
- band = FALSE;
- node = list = exporthtml_sort_name( folder->listPerson );
- while( node ) {
- AddrItemObject *aio = node->data;
- if( aio && aio->type == ITEMTYPE_PERSON ) {
- ItemPerson *person = ( ItemPerson * ) aio;
-
- /* Format first/last/nick name */
- *buf = '\0';
- exporthtml_fmt_fullname( ctl, buf,person );
-
- fprintf( stream, "<tr valign=\"top\"" );
- if( ctl->banding ) {
- if( band ) {
- tagName = _idTagRowOdd_;
- }
- else {
- tagName = _idTagRowEven_;
- }
- fprintf( stream, " class=\"%s\"", tagName );
- band = ! band;
- }
- fprintf( stream, ">\n" );
-
- fprintf( stream, " <td class=\"tab-dn\">" );
- fprintf( stream, "%s", ADDRITEM_NAME( person ) );
- fprintf( stream, "</td>\n" );
-
- fprintf( stream, " <td class=\"tab-addr\">" );
- exporthtml_fmt_email( ctl, stream, person->listEMail, FALSE );
- fprintf( stream, "</td>\n" );
-
- fprintf( stream, " <td class=\"tab-fn\">" );
- if( *buf ) {
- fprintf( stream, "%s", buf );
- }
- else {
- fprintf( stream, "%s", SC_HTML_SPACE );
- }
- fprintf( stream, "</td>\n" );
-
- if( ctl->showAttribs ) {
- fprintf( stream, " <td class=\"tab-attr\">" );
- exporthtml_fmt_attribs(
- ctl, stream, person->listAttrib );
- fprintf( stream, "</td>\n" );
- }
- fprintf( stream, "</tr>\n" );
-
- retVal = FALSE;
- }
- node = g_list_next( node );
- }
-
- g_list_free( list );
- fprintf( stream, "</table>\n" );
- return retVal;
-}
-
-/*
- * Format folder heirarchy.
- * Enter: stream Output stream.
- * list Heirarchy list.
- */
-static void exporthtml_fmt_folderhead( FILE *stream, const GList *list ) {
- const GList *node;
- gboolean flag;
- gchar *name;
-
- flag = FALSE;
- node = list;
- while( node ) {
- AddrItemObject *aio = node->data;
- if( aio && aio->type == ITEMTYPE_FOLDER ) {
- ItemFolder *folder = ( ItemFolder * ) aio;
-
- name = ADDRITEM_NAME( folder );
- if( name ) {
- if( flag ) {
- fprintf( stream, " > " );
- }
- fprintf( stream, "%s", name );
- flag = TRUE;
- }
- }
- node = g_list_next( node );
- }
-}
-
-/*
- * Format an address book folder.
- * Enter: ctl Export control data.
- * stream Output stream.
- * folder Folder.
- */
-static void exporthtml_fmt_folder(
- ExportHtmlCtl *ctl, FILE *stream, const ItemFolder *folder )
-{
- const GList *node;
- GList *listHeir, *list;
- const gchar *name;
- gboolean ret1;
-
- name = ADDRITEM_NAME( folder );
- if( name ) {
- listHeir = addritem_folder_path( folder, TRUE );
- if( listHeir ) {
- fprintf( stream, "<p class=\"fmt-folder\">" );
- fprintf( stream, "%s: ", _( "Folder" ) );
- exporthtml_fmt_folderhead( stream, listHeir );
- fprintf( stream, "</p>\n" );
- g_list_free( listHeir );
- }
- }
-
- ret1 = exporthtml_fmt_person( ctl, stream, folder );
- exporthtml_fmt_group( ctl, stream, folder, ret1 );
-
- node = list = exporthtml_sort_name( folder->listFolder );
- while( node ) {
- AddrItemObject *aio = node->data;
- if( aio && aio->type == ITEMTYPE_FOLDER ) {
- ItemFolder *subFolder = ( ItemFolder * ) aio;
- exporthtml_fmt_folder( ctl, stream, subFolder );
- }
- node = g_list_next( node );
- }
- if( list ) {
- g_list_free( list );
- }
-}
-
-/*
- * Format header block.
- * Enter: ctl Export control data.
- * stream Output stream.
- * title Page title.
- */
-static void exporthtml_fmt_header(
- ExportHtmlCtl *ctl, FILE *stream, gchar *title )
-{
- StylesheetEntry *entry;
-
- entry = exporthtml_find_stylesheet( ctl );
-
- fprintf( stream,
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n" );
- fprintf( stream,
- "\"http://www.w3.org/TR/html4/loose.dtd\">\n" );
- fprintf( stream, "<html>\n" );
- fprintf( stream, "<head>\n" );
-
- if( ctl->encoding && strlen( ctl->encoding ) > 0 ) {
- fprintf( stream, "<meta " );
- fprintf( stream, "http-equiv=\"Content-Type\" " );
- fprintf( stream, "content=\"text/html; charset=%s\">\n",
- ctl->encoding );
- }
-
- fprintf( stream, "<title>%s</title>\n", title );
-
- if( entry != NULL ) {
- if( entry->fileName && strlen( entry->fileName ) > 0 ) {
- fprintf( stream, "<link " );
- fprintf( stream, "rel=\"stylesheet\" " );
- fprintf( stream, "type=\"text/css\" " );
- fprintf( stream, "href=\"%s\" >\n", entry->fileName );
- }
- }
- fprintf( stream, "</head>\n" );
-}
-
-/*
- * ============================================================================
- * Export address book to HTML file.
- * Enter: ctl Export control data.
- * cache Address book/data source cache.
- * Return: Status.
- * ============================================================================
- */
-void exporthtml_process(
- ExportHtmlCtl *ctl, AddressCache *cache )
-{
- ItemFolder *rootFolder;
- FILE *htmlFile;
- time_t tt;
- gchar *dsName;
- static gchar *title;
- gchar buf[512];
-
- htmlFile = g_fopen( ctl->path, "wb" );
- if( ! htmlFile ) {
- /* Cannot open file */
- g_print( "Cannot open file for write\n" );
- ctl->retVal = MGU_OPEN_FILE;
- return;
- }
-
- title = _( "Claws Mail Address Book" );
- rootFolder = cache->rootFolder;
- dsName = cache->name;
-
- exporthtml_fmt_header( ctl, htmlFile, title );
-
- fprintf( htmlFile, "<body>\n" );
- fprintf( htmlFile, "<h1>%s</h1>\n", title );
-
- fprintf( htmlFile, "<p class=\"fmt-folder\">" );
- fprintf( htmlFile, "%s: ", _( "Address Book" ) );
- fprintf( htmlFile, "%s", dsName );
- fprintf( htmlFile, "</p>\n" );
-
- exporthtml_fmt_folder( ctl, htmlFile, rootFolder );
-
- tt = time( NULL );
- fprintf( htmlFile, "<p>%s</p>\n", ctime_r( &tt, buf ) );
- fprintf( htmlFile, "<hr width=\"100%%\">\n" );
-
- fprintf( htmlFile, "</body>\n" );
- fprintf( htmlFile, "</html>\n" );
-
- safe_fclose( htmlFile );
- ctl->retVal = MGU_SUCCESS;
-
- /* Create stylesheet files */
- exporthtml_create_css_files( ctl );
-
-}
-
-/*
- * Build full export file specification.
- * Enter: ctl Export control data.
- */
-static void exporthtml_build_filespec( ExportHtmlCtl *ctl ) {
- gchar *fileSpec;
-
- fileSpec = g_strconcat(
- ctl->dirOutput, G_DIR_SEPARATOR_S, ctl->fileHtml, NULL );
- ctl->path = mgu_replace_string( ctl->path, fileSpec );
- g_free( fileSpec );
-}
-
-/*
- * ============================================================================
- * Parse directory and filename from full export file specification.
- * Enter: ctl Export control data.
- * fileSpec File spec.
- * ============================================================================
- */
-void exporthtml_parse_filespec( ExportHtmlCtl *ctl, gchar *fileSpec ) {
- gchar *t;
- gchar *base = g_path_get_basename(fileSpec);
-
- ctl->fileHtml =
- mgu_replace_string( ctl->fileHtml, base );
- g_free(base);
- t = g_path_get_dirname( fileSpec );
- ctl->dirOutput = mgu_replace_string( ctl->dirOutput, t );
- g_free( t );
- ctl->path = mgu_replace_string( ctl->path, fileSpec );
-}
-
-/*
- * ============================================================================
- * Create output directory.
- * Enter: ctl Export control data.
- * Return: TRUE if directory created.
- * ============================================================================
- */
-gboolean exporthtml_create_dir( ExportHtmlCtl *ctl ) {
- gboolean retVal = FALSE;
-
- ctl->rcCreate = 0;
- if( g_mkdir( ctl->dirOutput, S_IRWXU ) == 0 ) {
- retVal = TRUE;
- }
- else {
- ctl->rcCreate = errno;
- }
- return retVal;
-}
-
-/*
- * ============================================================================
- * Retrieve create directory error message.
- * Enter: ctl Export control data.
- * Return: Message.
- * ============================================================================
- */
-gchar *exporthtml_get_create_msg( ExportHtmlCtl *ctl ) {
- gchar *msg;
-
- if( ctl->rcCreate == EEXIST ) {
- msg = _( "Name already exists but is not a directory." );
- }
- else if( ctl->rcCreate == EACCES ) {
- msg = _( "No permissions to create directory." );
- }
- else if( ctl->rcCreate == ENAMETOOLONG ) {
- msg = _( "Name is too long." );
- }
- else {
- msg = _( "Not specified." );
- }
- return msg;
-}
-
-/*
- * Set default values.
- * Enter: ctl Export control data.
- */
-static void exporthtml_default_values( ExportHtmlCtl *ctl ) {
- gchar *str;
-
- str = g_strconcat(
- get_home_dir(), G_DIR_SEPARATOR_S,
- DFL_DIR_CLAWS_OUT, NULL );
-
- ctl->dirOutput = mgu_replace_string( ctl->dirOutput, str );
- g_free( str );
-
- ctl->fileHtml =
- mgu_replace_string( ctl->fileHtml, DFL_FILE_CLAWS_OUT );
- ctl->encoding = NULL;
- ctl->stylesheet = EXPORT_HTML_ID_DEFAULT;
- ctl->nameFormat = EXPORT_HTML_FIRST_LAST;
- ctl->banding = TRUE;
- ctl->linkEMail = TRUE;
- ctl->showAttribs = TRUE;
- ctl->retVal = MGU_SUCCESS;
-}
-
-/*
- * ============================================================================
- * Load settings from XML properties file.
- * Enter: ctl Export control data.
- * ============================================================================
- */
-void exporthtml_load_settings( ExportHtmlCtl *ctl ) {
- XmlProperty *props;
- gint rc;
- gchar buf[256];
-
- *buf = '\0';
- props = xmlprops_create();
- xmlprops_set_path( props, ctl->settingsFile );
- rc = xmlprops_load_file( props );
- if( rc == 0 ) {
- /* Read settings */
- xmlprops_get_property_s( props, EXMLPROP_DIRECTORY, buf );
- ctl->dirOutput = mgu_replace_string( ctl->dirOutput, buf );
-
- xmlprops_get_property_s( props, EXMLPROP_FILE, buf );
- ctl->fileHtml = mgu_replace_string( ctl->fileHtml, buf );
-
- ctl->stylesheet =
- xmlprops_get_property_i( props, EXMLPROP_STYLESHEET );
- ctl->nameFormat =
- xmlprops_get_property_i( props, EXMLPROP_FMT_NAME );
- ctl->banding =
- xmlprops_get_property_b( props, EXMLPROP_BANDING );
- ctl->linkEMail =
- xmlprops_get_property_b( props, EXMLPROP_FMT_EMAIL );
- ctl->showAttribs =
- xmlprops_get_property_b( props, EXMLPROP_FMT_ATTRIB );
- }
- else {
- /* Set default values */
- exporthtml_default_values( ctl );
- }
- exporthtml_build_filespec( ctl );
- /* exporthtml_print( ctl, stdout ); */
-
- xmlprops_free( props );
-}
-
-/*
- * ============================================================================
- * Save settings to XML properties file.
- * Enter: ctl Export control data.
- * ============================================================================
- */
-void exporthtml_save_settings( ExportHtmlCtl *ctl ) {
- XmlProperty *props;
-
- props = xmlprops_create();
- xmlprops_set_path( props, ctl->settingsFile );
-
- xmlprops_set_property( props, EXMLPROP_DIRECTORY, ctl->dirOutput );
- xmlprops_set_property( props, EXMLPROP_FILE, ctl->fileHtml );
- xmlprops_set_property_i( props, EXMLPROP_STYLESHEET, ctl->stylesheet );
- xmlprops_set_property_i( props, EXMLPROP_FMT_NAME, ctl->nameFormat );
- xmlprops_set_property_b( props, EXMLPROP_BANDING, ctl->banding );
- xmlprops_set_property_b( props, EXMLPROP_FMT_EMAIL, ctl->linkEMail );
- xmlprops_set_property_b( props, EXMLPROP_FMT_ATTRIB, ctl->showAttribs );
- if (xmlprops_save_file( props ) != MGU_SUCCESS)
- g_warning("can't save settings");
- xmlprops_free( props );
-}
diff --git a/src/exporthtml.h b/src/exporthtml.h
@@ -1,85 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 Match Grun and the Claws Mail team
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * Definitions for an E-Mail address harvester.
- */
-
-#ifndef __EXPORT_HTML_H__
-#define __EXPORT_HTML_H__
-
-#include <glib.h>
-
-#include "addrcache.h"
-
-/* Stylesheet ID's */
-#define EXPORT_HTML_ID_NONE 0
-#define EXPORT_HTML_ID_DEFAULT 1
-#define EXPORT_HTML_ID_FULL 2
-#define EXPORT_HTML_ID_CUSTOM 3
-#define EXPORT_HTML_ID_CUSTOM2 4
-#define EXPORT_HTML_ID_CUSTOM3 5
-#define EXPORT_HTML_ID_CUSTOM4 6
-
-#define EXPORT_HTML_FIRST_LAST 0
-#define EXPORT_HTML_LAST_FIRST 1
-
-/* Export HTML control data */
-typedef struct _ExportHtmlCtl ExportHtmlCtl;
-struct _ExportHtmlCtl {
- gchar *path;
- gchar *dirOutput;
- gchar *fileHtml;
- gchar *encoding;
- gchar *settingsFile;
- gint stylesheet;
- gint nameFormat;
- gboolean banding;
- gboolean linkEMail;
- gboolean showAttribs;
- gint retVal;
- gint rcCreate;
- GList *listStyle;
-};
-
-/* Function prototypes */
-ExportHtmlCtl *exporthtml_create( void );
-void exporthtml_free ( ExportHtmlCtl *ctl );
-void exporthtml_set_stylesheet ( ExportHtmlCtl *ctl,
- const gint value );
-void exporthtml_set_name_format ( ExportHtmlCtl *ctl,
- const gint value );
-void exporthtml_set_banding ( ExportHtmlCtl *ctl,
- const gboolean value );
-void exporthtml_set_link_email ( ExportHtmlCtl *ctl,
- const gboolean value );
-void exporthtml_set_attributes ( ExportHtmlCtl *ctl,
- const gboolean value );
-void exporthtml_process ( ExportHtmlCtl *ctl,
- AddressCache *cache );
-gboolean exporthtml_create_dir ( ExportHtmlCtl *ctl );
-gchar *exporthtml_get_create_msg( ExportHtmlCtl *ctl );
-
-void exporthtml_parse_filespec ( ExportHtmlCtl *ctl,
- gchar *fileSpec );
-void exporthtml_load_settings ( ExportHtmlCtl *ctl );
-void exporthtml_save_settings ( ExportHtmlCtl *ctl );
-
-#endif /* __EXPORT_HTML_H__ */
-