diff options
author | Slávek Banko <[email protected]> | 2014-03-03 13:46:44 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2014-03-03 13:46:44 +0100 |
commit | 2e02da046d3e56cdf4744f644af35ad07424f48b (patch) | |
tree | f2dcf353aa2338eae1c2ff2c41af971c580c2762 /src/core | |
parent | 3c13229d98167ae4ae0710d5eeef23fef5005bf0 (diff) | |
download | tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.tar.gz tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.zip |
Update to upstream version 1.3.6
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Makefile.am | 2 | ||||
-rw-r--r-- | src/core/dcopinterface_skel.cpp | 48 | ||||
-rw-r--r-- | src/core/drophandler.cpp | 37 |
3 files changed, 56 insertions, 31 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 15fc0df..01bf5a8 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -17,6 +17,8 @@ drophandler.h drophandler.cpp \ tellico-rename.upd tellico.upd \ tellico-1-3-update.pl +dcopinterface_DCOPIDLNG = ALL + kde_kcfg_DATA = tellico_config.kcfg updatedir = $(kde_datadir)/tdeconf_update diff --git a/src/core/dcopinterface_skel.cpp b/src/core/dcopinterface_skel.cpp index 8de56bf..4e819ed 100644 --- a/src/core/dcopinterface_skel.cpp +++ b/src/core/dcopinterface_skel.cpp @@ -25,11 +25,11 @@ static const char* const ApplicationInterface_ftable[16][3] = { { "bool", "exportHTML(TQString)", "exportHTML(TQString file)" }, { "bool", "exportCSV(TQString)", "exportCSV(TQString file)" }, { "bool", "exportPilotDB(TQString)", "exportPilotDB(TQString file)" }, - { "TQValueList<long int>", "selectedEntries()", "selectedEntries()" }, - { "TQValueList<long int>", "filteredEntries()", "filteredEntries()" }, + { "TQValueList<long>", "selectedEntries()", "selectedEntries()" }, + { "TQValueList<long>", "filteredEntries()", "filteredEntries()" }, { "void", "openFile(TQString)", "openFile(TQString file)" }, { "void", "setFilter(TQString)", "setFilter(TQString text)" }, - { "bool", "showEntry(long int)", "showEntry(long int id)" }, + { "bool", "showEntry(long)", "showEntry(long id)" }, { 0, 0, 0 } }; static const int ApplicationInterface_ftable_hiddens[15] = { @@ -162,12 +162,12 @@ bool ApplicationInterface::process(const TQCString &fun, const TQByteArray &data TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << exportPilotDB(arg0 ); } break; - case 10: { // TQValueList<long int> selectedEntries() + case 10: { // TQValueList<long> selectedEntries() replyType = ApplicationInterface_ftable[10][0]; TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << selectedEntries( ); } break; - case 11: { // TQValueList<long int> filteredEntries() + case 11: { // TQValueList<long> filteredEntries() replyType = ApplicationInterface_ftable[11][0]; TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << filteredEntries( ); @@ -188,8 +188,8 @@ bool ApplicationInterface::process(const TQCString &fun, const TQByteArray &data replyType = ApplicationInterface_ftable[13][0]; setFilter(arg0 ); } break; - case 14: { // bool showEntry(long int) - long int arg0; + case 14: { // bool showEntry(long) + long arg0; TQDataStream arg( data, IO_ReadOnly ); if (arg.atEnd()) return false; arg >> arg0; @@ -233,14 +233,14 @@ namespace Tellico { static const int CollectionInterface_fhash = 11; static const char* const CollectionInterface_ftable[9][3] = { - { "long int", "addEntry()", "addEntry()" }, - { "bool", "removeEntry(long int)", "removeEntry(long int entryID)" }, + { "long", "addEntry()", "addEntry()" }, + { "bool", "removeEntry(long)", "removeEntry(long entryID)" }, { TQSTRINGLIST_OBJECT_NAME_STRING, "values(TQString)", "values(TQString fieldName)" }, - { TQSTRINGLIST_OBJECT_NAME_STRING, "values(long int,TQString)", "values(long int entryID,TQString fieldName)" }, + { TQSTRINGLIST_OBJECT_NAME_STRING, "values(long,TQString)", "values(long entryID,TQString fieldName)" }, { TQSTRINGLIST_OBJECT_NAME_STRING, "bibtexKeys()", "bibtexKeys()" }, - { TQSTRING_OBJECT_NAME_STRING, "bibtexKey(long int)", "bibtexKey(long int entryID)" }, - { "bool", "setFieldValue(long int,TQString,TQString)", "setFieldValue(long int entryID,TQString fieldName,TQString value)" }, - { "bool", "addFieldValue(long int,TQString,TQString)", "addFieldValue(long int entryID,TQString fieldName,TQString value)" }, + { TQSTRING_OBJECT_NAME_STRING, "bibtexKey(long)", "bibtexKey(long entryID)" }, + { "bool", "setFieldValue(long,TQString,TQString)", "setFieldValue(long entryID,TQString fieldName,TQString value)" }, + { "bool", "addFieldValue(long,TQString,TQString)", "addFieldValue(long entryID,TQString fieldName,TQString value)" }, { 0, 0, 0 } }; static const int CollectionInterface_ftable_hiddens[8] = { @@ -264,13 +264,13 @@ bool CollectionInterface::process(const TQCString &fun, const TQByteArray &data, } int* fp = fdict->find( fun ); switch ( fp?*fp:-1) { - case 0: { // long int addEntry() + case 0: { // long addEntry() replyType = CollectionInterface_ftable[0][0]; TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << addEntry( ); } break; - case 1: { // bool removeEntry(long int) - long int arg0; + case 1: { // bool removeEntry(long) + long arg0; TQDataStream arg( data, IO_ReadOnly ); if (arg.atEnd()) return false; arg >> arg0; @@ -287,8 +287,8 @@ bool CollectionInterface::process(const TQCString &fun, const TQByteArray &data, TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << values(arg0 ); } break; - case 3: { // TQStringList values(long int,TQString) - long int arg0; + case 3: { // TQStringList values(long,TQString) + long arg0; TQString arg1; TQDataStream arg( data, IO_ReadOnly ); if (arg.atEnd()) return false; @@ -304,8 +304,8 @@ bool CollectionInterface::process(const TQCString &fun, const TQByteArray &data, TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << bibtexKeys( ); } break; - case 5: { // TQString bibtexKey(long int) - long int arg0; + case 5: { // TQString bibtexKey(long) + long arg0; TQDataStream arg( data, IO_ReadOnly ); if (arg.atEnd()) return false; arg >> arg0; @@ -313,8 +313,8 @@ bool CollectionInterface::process(const TQCString &fun, const TQByteArray &data, TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << bibtexKey(arg0 ); } break; - case 6: { // bool setFieldValue(long int,TQString,TQString) - long int arg0; + case 6: { // bool setFieldValue(long,TQString,TQString) + long arg0; TQString arg1; TQString arg2; TQDataStream arg( data, IO_ReadOnly ); @@ -328,8 +328,8 @@ bool CollectionInterface::process(const TQCString &fun, const TQByteArray &data, TQDataStream _replyStream( replyData, IO_WriteOnly ); _replyStream << setFieldValue(arg0, arg1, arg2 ); } break; - case 7: { // bool addFieldValue(long int,TQString,TQString) - long int arg0; + case 7: { // bool addFieldValue(long,TQString,TQString) + long arg0; TQString arg1; TQString arg2; TQDataStream arg( data, IO_ReadOnly ); diff --git a/src/core/drophandler.cpp b/src/core/drophandler.cpp index e609e7b..8d4875d 100644 --- a/src/core/drophandler.cpp +++ b/src/core/drophandler.cpp @@ -15,9 +15,13 @@ #include "../mainwindow.h" #include "../tellico_kernel.h" #include "../tellico_debug.h" +#include "../translators/bibteximporter.h" +#include "../translators/risimporter.h" #include <kurldrag.h> #include <kmimetype.h> +#include <tdeio/netaccess.h> +#include <tdeio/job.h> using Tellico::DropHandler; @@ -62,18 +66,37 @@ bool DropHandler::handleURL(const KURL::List& urls_) { bool hasUnknown = false; KURL::List tc, pdf, bib, ris; for(KURL::List::ConstIterator it = urls_.begin(); it != urls_.end(); ++it) { - KMimeType::Ptr ptr = KMimeType::findByURL(*it); + const KURL& url = *it; + KMimeType::Ptr ptr; + // findByURL doesn't work for http, so actually query + // the url itself + if(url.protocol() != TQString::fromLatin1("http")) { + ptr = KMimeType::findByURL(url); + } else { + TDEIO::MimetypeJob* job = TDEIO::mimetype(url, false /*progress*/); + TDEIO::NetAccess::synchronousRun(job, Kernel::self()->widget()); + ptr = KMimeType::mimeType(job->mimetype()); + } if(ptr->is(TQString::fromLatin1("application/x-tellico"))) { - tc << *it; + tc << url; } else if(ptr->is(TQString::fromLatin1("application/pdf"))) { - pdf << *it; + pdf << url; } else if(ptr->is(TQString::fromLatin1("text/x-bibtex")) || - ptr->is(TQString::fromLatin1("application/x-bibtex"))) { - bib << *it; + ptr->is(TQString::fromLatin1("application/x-bibtex")) || + ptr->is(TQString::fromLatin1("application/bibtex"))) { + bib << url; } else if(ptr->is(TQString::fromLatin1("application/x-research-info-systems"))) { - ris << *it; + ris << url; + } else if(url.fileName().endsWith(TQString::fromLatin1(".bib"))) { + bib << url; + } else if(url.fileName().endsWith(TQString::fromLatin1(".ris"))) { + ris << url; + } else if(ptr->is(TQString::fromLatin1("text/plain")) && Import::BibtexImporter::maybeBibtex(url)) { + bib << url; + } else if(ptr->is(TQString::fromLatin1("text/plain")) && Import::RISImporter::maybeRIS(url)) { + ris << url; } else { - myDebug() << "DropHandler::handleURL() - unrecognized type: " << ptr->name() << " (" << *it << ")" << endl; + myDebug() << "DropHandler::handleURL() - unrecognized type: " << ptr->name() << " (" << url << ")" << endl; hasUnknown = true; } } |