index e9ef6344369ec8910b73402a0d1a02a27576c372..2ae7d6989f05a76ed3ad5b386402d8f31ffcaee6 100644 (file)
-/**
- * Implementation of the ocal dialog interfaces defined in ocaldialog.h
- *
- * Authors:
+/** @file
+ * @brief Open Clip Art Library integration dialogs - implementation
+ */
+/* Authors:
* Bruno Dilly
* Other dudes from The Inkscape Organization
*
* Bruno Dilly
* Other dudes from The Inkscape Organization
*
#include "interface.h"
#include "gc-core.h"
#include <dialogs/dialog-events.h>
#include "interface.h"
#include "gc-core.h"
#include <dialogs/dialog-events.h>
+#include "io/sys.h"
+#include "preferences.h"
namespace Inkscape
{
namespace Inkscape
{
/**
* Callback for fileNameEntry widget
*/
/**
* Callback for fileNameEntry widget
*/
+/*
void FileExportToOCALDialog::fileNameEntryChangedCallback()
{
if (!fileNameEntry)
void FileExportToOCALDialog::fileNameEntryChangedCallback()
{
if (!fileNameEntry)
myFilename = fileName;
response(Gtk::RESPONSE_OK);
}
myFilename = fileName;
response(Gtk::RESPONSE_OK);
}
-
+*/
/**
* Constructor
*/
/**
* Constructor
*/
+/*
FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow,
FileDialogType fileTypes,
const Glib::ustring &title) :
FileDialogOCALBase(title, parentWindow)
{
FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow,
FileDialogType fileTypes,
const Glib::ustring &title) :
FileDialogOCALBase(title, parentWindow)
{
- /*
+*/
+ /*
* Start Taking the vertical Box and putting a Label
* and a Entry to take the filename
* Later put the extension selection and checkbox (?)
*/
/* Initalize to Autodetect */
* Start Taking the vertical Box and putting a Label
* and a Entry to take the filename
* Later put the extension selection and checkbox (?)
*/
/* Initalize to Autodetect */
+/*
extension = NULL;
extension = NULL;
+*/
/* No filename to start out with */
/* No filename to start out with */
+/*
myFilename = "";
myFilename = "";
+*/
/* Set our dialog type (save, export, etc...)*/
/* Set our dialog type (save, export, etc...)*/
+/*
dialogType = fileTypes;
Gtk::VBox *vbox = get_vbox();
dialogType = fileTypes;
Gtk::VBox *vbox = get_vbox();
show_all_children();
}
show_all_children();
}
-
+*/
/**
* Destructor
*/
/**
* Destructor
*/
+/*
FileExportToOCALDialog::~FileExportToOCALDialog()
{
}
FileExportToOCALDialog::~FileExportToOCALDialog()
{
}
-
+*/
/**
* Show this dialog modally. Return true if user hits [OK]
*/
/**
* Show this dialog modally. Return true if user hits [OK]
*/
+/*
bool
FileExportToOCALDialog::show()
{
bool
FileExportToOCALDialog::show()
{
return FALSE;
}
}
return FALSE;
}
}
-
+*/
/**
* Get the file name chosen by the user. Valid after an [OK]
*/
/**
* Get the file name chosen by the user. Valid after an [OK]
*/
+/*
Glib::ustring
FileExportToOCALDialog::getFilename()
{
Glib::ustring
FileExportToOCALDialog::getFilename()
{
{
this->set_title(title);
}
{
this->set_title(title);
}
-
+*/
//########################################################################
//# F I L E E X P O R T T O O C A L P A S S W O R D
//########################################################################
//# F I L E E X P O R T T O O C A L P A S S W O R D
/**
* Constructor
*/
/**
* Constructor
*/
+/*
FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &parentWindow,
const Glib::ustring &title) : FileDialogOCALBase(title, parentWindow)
{
FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &parentWindow,
const Glib::ustring &title) : FileDialogOCALBase(title, parentWindow)
{
+*/
/*
* Start Taking the vertical Box and putting 2 Labels
* and 2 Entries to take the username and password
*/
/* No username and password to start out with */
/*
* Start Taking the vertical Box and putting 2 Labels
* and 2 Entries to take the username and password
*/
/* No username and password to start out with */
+/*
myUsername = "";
myPassword = "";
myUsername = "";
myPassword = "";
@@ -198,18 +214,20 @@ FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &pare
show_all_children();
}
show_all_children();
}
-
+*/
/**
* Destructor
*/
/**
* Destructor
*/
+/*
FileExportToOCALPasswordDialog::~FileExportToOCALPasswordDialog()
{
}
FileExportToOCALPasswordDialog::~FileExportToOCALPasswordDialog()
{
}
-
+*/
/**
* Show this dialog modally. Return true if user hits [OK]
*/
/**
* Show this dialog modally. Return true if user hits [OK]
*/
+/*
bool
FileExportToOCALPasswordDialog::show()
{
bool
FileExportToOCALPasswordDialog::show()
{
return FALSE;
}
}
return FALSE;
}
}
-
+*/
/**
* Get the username. Valid after an [OK]
*/
/**
* Get the username. Valid after an [OK]
*/
+/*
Glib::ustring
FileExportToOCALPasswordDialog::getUsername()
{
myUsername = usernameEntry->get_text();
return myUsername;
}
Glib::ustring
FileExportToOCALPasswordDialog::getUsername()
{
myUsername = usernameEntry->get_text();
return myUsername;
}
-
+*/
/**
* Get the password. Valid after an [OK]
*/
/**
* Get the password. Valid after an [OK]
*/
+/*
Glib::ustring
FileExportToOCALPasswordDialog::getPassword()
{
Glib::ustring
FileExportToOCALPasswordDialog::getPassword()
{
{
this->set_title(title);
}
{
this->set_title(title);
}
-
+*/
//#########################################################################
//### F I L E I M P O R T F R O M O C A L
//#########################################################################
//### F I L E I M P O R T F R O M O C A L
// create file path
const std::string tmptemplate = "ocal-";
std::string tmpname;
// create file path
const std::string tmptemplate = "ocal-";
std::string tmpname;
- int fd = Glib::file_open_tmp(tmpname, tmptemplate);
+ int fd = Inkscape::IO::file_open_tmp(tmpname, tmptemplate);
if (fd<0) {
g_warning("Error creating temp file");
return;
if (fd<0) {
g_warning("Error creating temp file");
return;
//get file url
fileUrl = get_text(posArray[0], 1); //http url
//get file url
fileUrl = get_text(posArray[0], 1); //http url
+ //Inkscape::Preferences *prefs = Inkscape::Preferences::get();
//Glib::ustring fileUrl = "dav://"; //dav url
//Glib::ustring fileUrl = "dav://"; //dav url
- //fileUrl.append(prefs_get_string_attribute("options.ocalurl", "str"));
+ //fileUrl.append(prefs->getString("/options/ocalurl/str"));
//fileUrl.append("/dav.php/");
//fileUrl.append(get_text(posArray[0], 3)); //author dir
//fileUrl.append("/");
//fileUrl.append("/dav.php/");
//fileUrl.append(get_text(posArray[0], 3)); //author dir
//fileUrl.append("/");
notFoundLabel->hide();
descriptionLabel->set_text("");
notFoundLabel->hide();
descriptionLabel->set_text("");
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Glib::ustring searchTag = searchTagEntry->get_text();
// create the ocal uri to get rss feed
Glib::ustring uri = "http://";
Glib::ustring searchTag = searchTagEntry->get_text();
// create the ocal uri to get rss feed
Glib::ustring uri = "http://";
- uri.append(prefs_get_string_attribute("options.ocalurl", "str"));
+ uri.append(prefs->getString("/options/ocalurl/str"));
uri.append("/media/feed/rss/");
uri.append(searchTag);
if (!Glib::get_charset()) //If we are not utf8
uri.append("/media/feed/rss/");
uri.append(searchTag);
if (!Glib::get_charset()) //If we are not utf8
result = gnome_vfs_open (&from_handle, uri.c_str(), GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK) {
result = gnome_vfs_open (&from_handle, uri.c_str(), GNOME_VFS_OPEN_READ);
if (result != GNOME_VFS_OK) {
- sp_ui_error_dialog(_("Failed to receive the Open Clip Art Library RSS feed. Verify if the server name is correct in Configuration->Misc (e.g.: openclipart.org)"));
+ sp_ui_error_dialog(_("Failed to receive the Open Clip Art Library RSS feed. Verify if the server name is correct in Configuration->Import/Export (e.g.: openclipart.org)"));
return;
}
return;
}
doc = xmlReadIO ((xmlInputReadCallback) vfs_read_callback,
(xmlInputCloseCallback) gnome_vfs_close, from_handle, uri.c_str(), NULL,
doc = xmlReadIO ((xmlInputReadCallback) vfs_read_callback,
(xmlInputCloseCallback) gnome_vfs_close, from_handle, uri.c_str(), NULL,
- XML_PARSE_RECOVER);
+ XML_PARSE_RECOVER + XML_PARSE_NOWARNING + XML_PARSE_NOERROR);
if (doc == NULL) {
sp_ui_error_dialog(_("Server supplied malformed Clip Art feed"));
g_warning("Failed to parse %s\n", uri.c_str());
if (doc == NULL) {
sp_ui_error_dialog(_("Server supplied malformed Clip Art feed"));
g_warning("Failed to parse %s\n", uri.c_str());