summaryrefslogtreecommitdiffstats
path: root/src/file.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2019-11-01 19:27:57 +0000
committerMartin Owens <doctormo@gmail.com>2019-11-01 23:08:03 +0000
commita1253803f469ff6be714ec7ce2837286e719939d (patch)
treea0909acf5d2d74353e0a655c3afbfe9b1ef45d2f /src/file.cpp
parentfix #497 don't set 'd' style property (diff)
downloadinkscape-a1253803f469ff6be714ec7ce2837286e719939d.tar.gz
inkscape-a1253803f469ff6be714ec7ce2837286e719939d.zip
Remove OCAL
Diffstat (limited to 'src/file.cpp')
-rw-r--r--src/file.cpp207
1 files changed, 1 insertions, 206 deletions
diff --git a/src/file.cpp b/src/file.cpp
index 57ad8b54c..471b55cad 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -69,7 +69,7 @@
#include "style.h"
#include "ui/dialog/font-substitution.h"
-#include "ui/dialog/ocaldialogs.h"
+#include "ui/dialog/filedialog.h"
#include "ui/interface.h"
#include "ui/tools/tool-base.h"
#include "widgets/desktop-widget.h"
@@ -1270,211 +1270,6 @@ sp_file_import(Gtk::Window &parentWindow)
return;
}
-
-/*######################
-## E X P O R T T O O C A L
-######################*/
-
-/**
- * Display an Export dialog, export as the selected type if OK pressed
- */
-/*
-bool
-sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow)
-{
-
- if (!SP_ACTIVE_DOCUMENT)
- return false;
-
- SPDocument *doc = SP_ACTIVE_DOCUMENT;
-
- Glib::ustring export_path;
- Glib::ustring export_loc;
- Glib::ustring fileName;
- Inkscape::Extension::Extension *selectionType;
-
- bool success = false;
-
- static bool gotSuccess = false;
-
- Inkscape::XML::Node *repr = doc->getReprRoot();
- (void)repr;
-
- if (!doc->uri && !doc->isModifiedSinceSave())
- return false;
-
- // Get the default extension name
- Glib::ustring default_extension = "org.inkscape.output.svg.inkscape";
- char formatBuf[256];
-
- Glib::ustring filename_extension = ".svg";
- selectionType = Inkscape::Extension::db.get(default_extension.c_str());
-
- export_path = Glib::get_tmp_dir ();
-
- export_loc = export_path;
- export_loc.append(G_DIR_SEPARATOR_S);
- snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str());
- export_loc.append(formatBuf);
-
- // convert save_loc from utf-8 to locale
- // is this needed any more, now that everything is handled in
- // Inkscape::IO?
- Glib::ustring export_path_local = Glib::filename_from_utf8(export_path);
- if ( export_path_local.size() > 0)
- export_path = export_path_local;
-
- // Show the Export To OCAL dialog
- Inkscape::UI::Dialog::OCAL:ExportDialog *exportDialogInstance =
- new Inkscape::UI::Dialog::OCAL:ExportDialog
- parentWindow,
- Inkscape::UI::Dialog::EXPORT_TYPES,
- (char const *) _("Select file to export to")
- );
-
- success = exportDialogInstance->show();
- if (!success) {
- delete exportDialogInstance;
- return success;
- }
-
- fileName = exportDialogInstance->getFilename();
-
- delete exportDialogInstance;
- exportDialogInstance = NULL;;
-
- fileName.append(filename_extension.c_str());
- if (fileName.size() > 0) {
- Glib::ustring newFileName = Glib::filename_to_utf8(fileName);
-
- if ( newFileName.size()>0 )
- fileName = newFileName;
- else
- g_warning( "Error converting save filename to UTF-8." );
- }
- Glib::ustring filePath = export_path;
- filePath.append(G_DIR_SEPARATOR_S);
- filePath.append(Glib::path_get_basename(fileName));
-
- fileName = filePath;
-
- success = file_save(parentWindow, doc, filePath, selectionType, FALSE, FALSE, Inkscape::Extension::FILE_SAVE_METHOD_EXPORT);
-
- if (!success){
- gchar *text = g_strdup_printf(_("Error saving a temporary copy"));
- sp_ui_error_dialog(text);
-
- return success;
- }
-
- // Start submission now
-
- // Create the uri
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- Glib::ustring uri = "dav://";
- Glib::ustring username = prefs->getString("/options/ocalusername/str");
- Glib::ustring password = prefs->getString("/options/ocalpassword/str");
- if (username.empty() || password.empty())
- {
- Inkscape::UI::Dialog::FileExportToOCALPasswordDialog *exportPasswordDialogInstance = NULL;
- if(!gotSuccess)
- {
- exportPasswordDialogInstance = new Inkscape::UI::Dialog::FileExportToOCALPasswordDialog(
- parentWindow,
- (char const *) _("Open Clip Art Login"));
- success = exportPasswordDialogInstance->show();
- if (!success) {
- delete exportPasswordDialogInstance;
- return success;
- }
- }
- username = exportPasswordDialogInstance->getUsername();
- password = exportPasswordDialogInstance->getPassword();
-
- delete exportPasswordDialogInstance;
- exportPasswordDialogInstance = NULL;
- }
- uri.append(username);
- uri.append(":");
- uri.append(password);
- uri.append("@");
- uri.append(prefs->getString("/options/ocalurl/str"));
- uri.append("/dav.php/");
- uri.append(Glib::path_get_basename(fileName));
-
- // Save as a remote file using the dav protocol.
- success = file_save_remote(doc, uri, selectionType, FALSE, FALSE);
- remove(fileName.c_str());
- if (!success)
- {
- gchar *text = g_strdup_printf(_("Error exporting the document. Verify if the server name, username and password are correct, if the server has support for webdav and verify if you didn't forget to choose a license."));
- sp_ui_error_dialog(text);
- }
- else
- gotSuccess = true;
-
- return success;
-}
-*/
-/**
- * Export the current document to OCAL
- */
-/*
-void
-sp_file_export_to_ocal(Gtk::Window &parentWindow)
-{
-
- // Try to execute the new code and return;
- if (!SP_ACTIVE_DOCUMENT)
- return;
- bool success = sp_file_export_to_ocal_dialog(parentWindow);
- if (success)
- SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Document exported..."));
-}
-*/
-
-/*######################
-## I M P O R T F R O M O C A L
-######################*/
-
-Inkscape::UI::Dialog::OCAL::ImportDialog* import_ocal_dialog = nullptr;
-
-/**
- * Display an ImportFromOcal Dialog, and the selected document from OCAL
- */
-void on_import_from_ocal_response(Glib::ustring filename)
-{
- SPDocument *doc = SP_ACTIVE_DOCUMENT;
-
- if (!filename.empty()) {
- Inkscape::Extension::Extension *selection = import_ocal_dialog->get_selection_type();
- file_import(doc, filename, selection);
- }
-}
-
-void
-sp_file_import_from_ocal(Gtk::Window &parent_window)
-{
- static Glib::ustring import_path;
-
- SPDocument *doc = SP_ACTIVE_DOCUMENT;
- if (!doc)
- return;
-
- if (import_ocal_dialog == nullptr) {
- import_ocal_dialog = new
- Inkscape::UI::Dialog::OCAL::ImportDialog(
- parent_window,
- Inkscape::UI::Dialog::IMPORT_TYPES,
- (char const *)_("Import Clip Art"));
-
- import_ocal_dialog->signal_response().connect(
- sigc::ptr_fun(&on_import_from_ocal_response));
- }
-
- import_ocal_dialog->show_all();
-}
-
/*######################
## P R I N T
######################*/