diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Makefile.am | 27 | ||||
-rw-r--r-- | src/core/dcopinterface.cpp | 171 | ||||
-rw-r--r-- | src/core/dcopinterface.h | 85 | ||||
-rw-r--r-- | src/core/dcopinterface_skel.cpp | 374 | ||||
-rw-r--r-- | src/core/drophandler.cpp | 101 | ||||
-rw-r--r-- | src/core/drophandler.h | 39 | ||||
-rw-r--r-- | src/core/netaccess.cpp | 100 | ||||
-rw-r--r-- | src/core/netaccess.h | 47 | ||||
-rw-r--r-- | src/core/tellico-1-3-update.pl | 24 | ||||
-rw-r--r-- | src/core/tellico-rename.upd | 4 | ||||
-rw-r--r-- | src/core/tellico.upd | 26 | ||||
-rw-r--r-- | src/core/tellico_config.cpp | 455 | ||||
-rw-r--r-- | src/core/tellico_config.kcfg | 477 | ||||
-rw-r--r-- | src/core/tellico_config.kcfgc | 9 | ||||
-rw-r--r-- | src/core/tellico_config_addons.cpp | 171 | ||||
-rw-r--r-- | src/core/tellico_config_addons.h | 36 |
16 files changed, 2146 insertions, 0 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am new file mode 100644 index 0000000..2d61d84 --- /dev/null +++ b/src/core/Makefile.am @@ -0,0 +1,27 @@ +AM_CPPFLAGS = $(all_includes) + +noinst_LIBRARIES = libcore.a +libcore_a_SOURCES = dcopinterface.cpp dcopinterface.skel drophandler.cpp \ + netaccess.cpp tellico_config.cpp tellico_config.kcfgc tellico_config_addons.cpp + +libcore_a_METASOURCES = AUTO + +KDE_OPTIONS = noautodist + +EXTRA_DIST = \ +tellico_config.kcfg tellico_config.kcfgc \ +tellico_config_addons.h tellico_config_addons.cpp \ +dcopinterface.h dcopinterface.cpp \ +netaccess.h netaccess.cpp \ +drophandler.h drophandler.cpp \ +tellico-rename.upd tellico.upd \ +tellico-1-3-update.pl + +kde_kcfg_DATA = tellico_config.kcfg + +updatedir = $(kde_datadir)/kconf_update +update_DATA = tellico-rename.upd tellico.upd +update_SCRIPTS = tellico-1-3-update.pl + +CLEANFILES = *~ *.loT tellico_config.h tellico_config.cpp + diff --git a/src/core/dcopinterface.cpp b/src/core/dcopinterface.cpp new file mode 100644 index 0000000..f375b6b --- /dev/null +++ b/src/core/dcopinterface.cpp @@ -0,0 +1,171 @@ +/*************************************************************************** + copyright : (C) 2004-2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#include "dcopinterface.h" +#include "../latin1literal.h" +#include "../controller.h" +#include "../tellico_kernel.h" +#include "../document.h" +#include "../collection.h" +#include "../translators/bibtexhandler.h" + +using Tellico::ApplicationInterface; +using Tellico::CollectionInterface; + +Tellico::Import::Action ApplicationInterface::actionType(const QString& actionName) { + QString name = actionName.lower(); + if(name == Latin1Literal("append")) { + return Import::Append; + } else if(name == Latin1Literal("merge")) { + return Import::Merge; + } + return Import::Replace; +} + +QValueList<long> ApplicationInterface::selectedEntries() const { + QValueList<long> ids; + Data::EntryVec entries = Controller::self()->selectedEntries(); + for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { + ids << entry->id(); + } + return ids; +} + +QValueList<long> ApplicationInterface::filteredEntries() const { + QValueList<long> ids; + Data::EntryVec entries = Controller::self()->visibleEntries(); + for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { + ids << entry->id(); + } + return ids; +} + +long CollectionInterface::addEntry() { + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll) { + return -1; + } + Data::EntryPtr entry = new Data::Entry(coll); + Kernel::self()->addEntries(entry, false); + return entry->id(); +} + +bool CollectionInterface::removeEntry(long id_) { + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll) { + return false; + } + Data::EntryPtr entry = coll->entryById(id_); + if(!entry) { + return false; + } + Kernel::self()->removeEntries(entry); + return coll->entryById(id_) == 0; +} + +QStringList CollectionInterface::values(const QString& fieldName_) const { + QStringList results; + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll) { + return results; + } + Data::FieldPtr field = coll->fieldByName(fieldName_); + if(!field) { + field = coll->fieldByTitle(fieldName_); + } + if(!field) { + return results; + } + Data::EntryVec entries = Controller::self()->selectedEntries(); + for(Data::EntryVecIt entry = entries.begin(); entry != entries.end(); ++entry) { + results += entry->fields(field, false); + } + return results; +} + +QStringList CollectionInterface::values(long id_, const QString& fieldName_) const { + QStringList results; + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll) { + return results; + } + Data::FieldPtr field = coll->fieldByName(fieldName_); + if(!field) { + field = coll->fieldByTitle(fieldName_); + } + if(!field) { + return results; + } + Data::EntryPtr entry = coll->entryById(id_); + if(entry) { + results += entry->fields(field, false); + } + return results; +} + +QStringList CollectionInterface::bibtexKeys() const { + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll || coll->type() != Data::Collection::Bibtex) { + return QStringList(); + } + return BibtexHandler::bibtexKeys(Controller::self()->selectedEntries()); +} + +QString CollectionInterface::bibtexKey(long id_) const { + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll || coll->type() != Data::Collection::Bibtex) { + return QString(); + } + Data::EntryPtr entry = coll->entryById(id_); + if(!entry) { + return QString(); + } + return BibtexHandler::bibtexKeys(entry).first(); +} + +bool CollectionInterface::setFieldValue(long id_, const QString& fieldName_, const QString& value_) { + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll) { + return false; + } + Data::EntryPtr entry = coll->entryById(id_); + if(!entry) { + return false; + } + Data::EntryPtr oldEntry = new Data::Entry(*entry); + if(!entry->setField(fieldName_, value_)) { + return false; + } + Kernel::self()->modifyEntries(oldEntry, entry); + return true; +} + +bool CollectionInterface::addFieldValue(long id_, const QString& fieldName_, const QString& value_) { + Data::CollPtr coll = Data::Document::self()->collection(); + if(!coll) { + return false; + } + Data::EntryPtr entry = coll->entryById(id_); + if(!entry) { + return false; + } + Data::EntryPtr oldEntry = new Data::Entry(*entry); + QStringList values = entry->fields(fieldName_, false); + QStringList newValues = values; + newValues << value_; + if(!entry->setField(fieldName_, newValues.join(QString::fromLatin1("; ")))) { + return false; + } + Kernel::self()->modifyEntries(oldEntry, entry); + return true; +} diff --git a/src/core/dcopinterface.h b/src/core/dcopinterface.h new file mode 100644 index 0000000..018de80 --- /dev/null +++ b/src/core/dcopinterface.h @@ -0,0 +1,85 @@ +/*************************************************************************** + copyright : (C) 2004-2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#ifndef TELLICO_DCOPINTERFACE_H +#define TELLICO_DCOPINTERFACE_H + +#include "../translators/translators.h" + +#include <dcopobject.h> +#include <kurl.h> + +#include <qstringlist.h> // used in generated dcopinterface_skel.cpp + +namespace Tellico { + +class ApplicationInterface : public DCOPObject { +K_DCOP +k_dcop: + bool importTellico(const QString& file, const QString& action) + { return importFile(Import::TellicoXML, KURL::fromPathOrURL(file), actionType(action)); } + bool importBibtex(const QString& file, const QString& action) + { return importFile(Import::Bibtex, KURL::fromPathOrURL(file), actionType(action)); } + bool importMODS(const QString& file, const QString& action) + { return importFile(Import::MODS, KURL::fromPathOrURL(file), actionType(action)); } + bool importRIS(const QString& file, const QString& action) + { return importFile(Import::RIS, KURL::fromPathOrURL(file), actionType(action)); } + + bool exportXML(const QString& file) + { return exportCollection(Export::TellicoXML, KURL::fromPathOrURL(file)); } + bool exportZip(const QString& file) + { return exportCollection(Export::TellicoZip, KURL::fromPathOrURL(file)); } + bool exportBibtex(const QString& file) + { return exportCollection(Export::Bibtex, KURL::fromPathOrURL(file)); } + bool exportHTML(const QString& file) + { return exportCollection(Export::HTML, KURL::fromPathOrURL(file)); } + bool exportCSV(const QString& file) + { return exportCollection(Export::CSV, KURL::fromPathOrURL(file)); } + bool exportPilotDB(const QString& file) + { return exportCollection(Export::PilotDB, KURL::fromPathOrURL(file)); } + + QValueList<long> selectedEntries() const; + QValueList<long> filteredEntries() const; + + virtual void openFile(const QString& file) = 0; + virtual void setFilter(const QString& text) = 0; + virtual bool showEntry(long id) = 0; + +protected: + ApplicationInterface() : DCOPObject("tellico") {} + virtual bool importFile(Import::Format format, const KURL& url, Import::Action action) = 0; + virtual bool exportCollection(Export::Format format, const KURL& url) = 0; + +private: + Import::Action actionType(const QString& actionName); +}; + +class CollectionInterface : public DCOPObject { +K_DCOP +k_dcop: + CollectionInterface() : DCOPObject("collection") {} + + long addEntry(); + bool removeEntry(long entryID); + + QStringList values(const QString& fieldName) const; + QStringList values(long entryID, const QString& fieldName) const; + QStringList bibtexKeys() const; + QString bibtexKey(long entryID) const; + + bool setFieldValue(long entryID, const QString& fieldName, const QString& value); + bool addFieldValue(long entryID, const QString& fieldName, const QString& value); +}; + +} // end namespace +#endif diff --git a/src/core/dcopinterface_skel.cpp b/src/core/dcopinterface_skel.cpp new file mode 100644 index 0000000..9edf4ad --- /dev/null +++ b/src/core/dcopinterface_skel.cpp @@ -0,0 +1,374 @@ +/**************************************************************************** +** +** DCOP Skeleton generated by dcopidl2cpp from dcopinterface.kidl +** +** WARNING! All changes made in this file will be lost! +** +*****************************************************************************/ + +#include "./dcopinterface.h" + +#include <kdatastream.h> +#include <qasciidict.h> + +namespace Tellico { + +static const int ApplicationInterface_fhash = 17; +static const char* const ApplicationInterface_ftable[16][3] = { + { "bool", "importTellico(QString,QString)", "importTellico(QString file,QString action)" }, + { "bool", "importBibtex(QString,QString)", "importBibtex(QString file,QString action)" }, + { "bool", "importMODS(QString,QString)", "importMODS(QString file,QString action)" }, + { "bool", "importRIS(QString,QString)", "importRIS(QString file,QString action)" }, + { "bool", "exportXML(QString)", "exportXML(QString file)" }, + { "bool", "exportZip(QString)", "exportZip(QString file)" }, + { "bool", "exportBibtex(QString)", "exportBibtex(QString file)" }, + { "bool", "exportHTML(QString)", "exportHTML(QString file)" }, + { "bool", "exportCSV(QString)", "exportCSV(QString file)" }, + { "bool", "exportPilotDB(QString)", "exportPilotDB(QString file)" }, + { "QValueList<long int>", "selectedEntries()", "selectedEntries()" }, + { "QValueList<long int>", "filteredEntries()", "filteredEntries()" }, + { "void", "openFile(QString)", "openFile(QString file)" }, + { "void", "setFilter(QString)", "setFilter(QString text)" }, + { "bool", "showEntry(long int)", "showEntry(long int id)" }, + { 0, 0, 0 } +}; +static const int ApplicationInterface_ftable_hiddens[15] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +bool ApplicationInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData) +{ + static QAsciiDict<int>* fdict = 0; + if ( !fdict ) { + fdict = new QAsciiDict<int>( ApplicationInterface_fhash, true, false ); + for ( int i = 0; ApplicationInterface_ftable[i][1]; i++ ) + fdict->insert( ApplicationInterface_ftable[i][1], new int( i ) ); + } + int* fp = fdict->find( fun ); + switch ( fp?*fp:-1) { + case 0: { // bool importTellico(QString,QString) + QString arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = ApplicationInterface_ftable[0][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << importTellico(arg0, arg1 ); + } break; + case 1: { // bool importBibtex(QString,QString) + QString arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = ApplicationInterface_ftable[1][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << importBibtex(arg0, arg1 ); + } break; + case 2: { // bool importMODS(QString,QString) + QString arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = ApplicationInterface_ftable[2][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << importMODS(arg0, arg1 ); + } break; + case 3: { // bool importRIS(QString,QString) + QString arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = ApplicationInterface_ftable[3][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << importRIS(arg0, arg1 ); + } break; + case 4: { // bool exportXML(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[4][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << exportXML(arg0 ); + } break; + case 5: { // bool exportZip(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[5][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << exportZip(arg0 ); + } break; + case 6: { // bool exportBibtex(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[6][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << exportBibtex(arg0 ); + } break; + case 7: { // bool exportHTML(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[7][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << exportHTML(arg0 ); + } break; + case 8: { // bool exportCSV(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[8][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << exportCSV(arg0 ); + } break; + case 9: { // bool exportPilotDB(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[9][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << exportPilotDB(arg0 ); + } break; + case 10: { // QValueList<long int> selectedEntries() + replyType = ApplicationInterface_ftable[10][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << selectedEntries( ); + } break; + case 11: { // QValueList<long int> filteredEntries() + replyType = ApplicationInterface_ftable[11][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << filteredEntries( ); + } break; + case 12: { // void openFile(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[12][0]; + openFile(arg0 ); + } break; + case 13: { // void setFilter(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[13][0]; + setFilter(arg0 ); + } break; + case 14: { // bool showEntry(long int) + long int arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = ApplicationInterface_ftable[14][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << showEntry(arg0 ); + } break; + default: + return DCOPObject::process( fun, data, replyType, replyData ); + } + return true; +} + +QCStringList ApplicationInterface::interfaces() +{ + QCStringList ifaces = DCOPObject::interfaces(); + ifaces += "Tellico::ApplicationInterface"; + return ifaces; +} + +QCStringList ApplicationInterface::functions() +{ + QCStringList funcs = DCOPObject::functions(); + for ( int i = 0; ApplicationInterface_ftable[i][2]; i++ ) { + if (ApplicationInterface_ftable_hiddens[i]) + continue; + QCString func = ApplicationInterface_ftable[i][0]; + func += ' '; + func += ApplicationInterface_ftable[i][2]; + funcs << func; + } + return funcs; +} + +} // namespace + +#include <kdatastream.h> +#include <qasciidict.h> + +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)" }, + { "QStringList", "values(QString)", "values(QString fieldName)" }, + { "QStringList", "values(long int,QString)", "values(long int entryID,QString fieldName)" }, + { "QStringList", "bibtexKeys()", "bibtexKeys()" }, + { "QString", "bibtexKey(long int)", "bibtexKey(long int entryID)" }, + { "bool", "setFieldValue(long int,QString,QString)", "setFieldValue(long int entryID,QString fieldName,QString value)" }, + { "bool", "addFieldValue(long int,QString,QString)", "addFieldValue(long int entryID,QString fieldName,QString value)" }, + { 0, 0, 0 } +}; +static const int CollectionInterface_ftable_hiddens[8] = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + +bool CollectionInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData) +{ + static QAsciiDict<int>* fdict = 0; + if ( !fdict ) { + fdict = new QAsciiDict<int>( CollectionInterface_fhash, true, false ); + for ( int i = 0; CollectionInterface_ftable[i][1]; i++ ) + fdict->insert( CollectionInterface_ftable[i][1], new int( i ) ); + } + int* fp = fdict->find( fun ); + switch ( fp?*fp:-1) { + case 0: { // long int addEntry() + replyType = CollectionInterface_ftable[0][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << addEntry( ); + } break; + case 1: { // bool removeEntry(long int) + long int arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = CollectionInterface_ftable[1][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << removeEntry(arg0 ); + } break; + case 2: { // QStringList values(QString) + QString arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = CollectionInterface_ftable[2][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << values(arg0 ); + } break; + case 3: { // QStringList values(long int,QString) + long int arg0; + QString arg1; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + replyType = CollectionInterface_ftable[3][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << values(arg0, arg1 ); + } break; + case 4: { // QStringList bibtexKeys() + replyType = CollectionInterface_ftable[4][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << bibtexKeys( ); + } break; + case 5: { // QString bibtexKey(long int) + long int arg0; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + replyType = CollectionInterface_ftable[5][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << bibtexKey(arg0 ); + } break; + case 6: { // bool setFieldValue(long int,QString,QString) + long int arg0; + QString arg1; + QString arg2; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + if (arg.atEnd()) return false; + arg >> arg2; + replyType = CollectionInterface_ftable[6][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << setFieldValue(arg0, arg1, arg2 ); + } break; + case 7: { // bool addFieldValue(long int,QString,QString) + long int arg0; + QString arg1; + QString arg2; + QDataStream arg( data, IO_ReadOnly ); + if (arg.atEnd()) return false; + arg >> arg0; + if (arg.atEnd()) return false; + arg >> arg1; + if (arg.atEnd()) return false; + arg >> arg2; + replyType = CollectionInterface_ftable[7][0]; + QDataStream _replyStream( replyData, IO_WriteOnly ); + _replyStream << addFieldValue(arg0, arg1, arg2 ); + } break; + default: + return DCOPObject::process( fun, data, replyType, replyData ); + } + return true; +} + +QCStringList CollectionInterface::interfaces() +{ + QCStringList ifaces = DCOPObject::interfaces(); + ifaces += "Tellico::CollectionInterface"; + return ifaces; +} + +QCStringList CollectionInterface::functions() +{ + QCStringList funcs = DCOPObject::functions(); + for ( int i = 0; CollectionInterface_ftable[i][2]; i++ ) { + if (CollectionInterface_ftable_hiddens[i]) + continue; + QCString func = CollectionInterface_ftable[i][0]; + func += ' '; + func += CollectionInterface_ftable[i][2]; + funcs << func; + } + return funcs; +} + +} // namespace + diff --git a/src/core/drophandler.cpp b/src/core/drophandler.cpp new file mode 100644 index 0000000..e27df9d --- /dev/null +++ b/src/core/drophandler.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** + copyright : (C) 2007 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#include "drophandler.h" +#include "../mainwindow.h" +#include "../tellico_kernel.h" +#include "../tellico_debug.h" + +#include <kurldrag.h> +#include <kmimetype.h> + +using Tellico::DropHandler; + +DropHandler::DropHandler(QObject* parent_) : QObject(parent_) { +} + +DropHandler::~DropHandler() { +} + +// assume the object is always the main window, that's the +// only object with this event filter +bool DropHandler::eventFilter(QObject* obj_, QEvent* ev_) { + Q_UNUSED(obj_); + if(ev_->type() == QEvent::DragEnter) { + return dragEnter(static_cast<QDragEnterEvent*>(ev_)); + } else if(ev_->type() == QEvent::Drop) { + return drop(static_cast<QDropEvent*>(ev_)); + } + return false; +} + +bool DropHandler::dragEnter(QDragEnterEvent* event_) { + bool accept = KURLDrag::canDecode(event_) || QTextDrag::canDecode(event_); + if(accept) { + event_->accept(accept); + } + return accept; +} + +bool DropHandler::drop(QDropEvent* event_) { + KURL::List urls; + QString text; + + if(KURLDrag::decode(event_, urls)) { + } else if(QTextDrag::decode(event_, text) && !text.isEmpty()) { + urls << KURL(text); + } + return !urls.isEmpty() && handleURL(urls); +} + +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); + if(ptr->is(QString::fromLatin1("application/x-tellico"))) { + tc << *it; + } else if(ptr->is(QString::fromLatin1("application/pdf"))) { + pdf << *it; + } else if(ptr->is(QString::fromLatin1("text/x-bibtex")) || + ptr->is(QString::fromLatin1("application/x-bibtex"))) { + bib << *it; + } else if(ptr->is(QString::fromLatin1("application/x-research-info-systems"))) { + ris << *it; + } else { + myDebug() << "DropHandler::handleURL() - unrecognized type: " << ptr->name() << " (" << *it << ")" << endl; + hasUnknown = true; + } + } + MainWindow* mainWindow = ::qt_cast<MainWindow*>(Kernel::self()->widget()); + if(!mainWindow) { + myDebug() << "DropHandler::handleURL() - no main window!" << endl; + return !hasUnknown; + } + if(!tc.isEmpty()) { + mainWindow->importFile(Import::TellicoXML, tc); + } + if(!pdf.isEmpty()) { + mainWindow->importFile(Import::PDF, pdf); + } + if(!bib.isEmpty()) { + mainWindow->importFile(Import::Bibtex, bib); + } + if(!ris.isEmpty()) { + mainWindow->importFile(Import::RIS, ris); + } + // any unknown urls get passed + return !hasUnknown; +} + +#include "drophandler.moc" diff --git a/src/core/drophandler.h b/src/core/drophandler.h new file mode 100644 index 0000000..ac4d146 --- /dev/null +++ b/src/core/drophandler.h @@ -0,0 +1,39 @@ +/*************************************************************************** + copyright : (C) 2007 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#ifndef TELLICO_DROPHANDLER_H +#define TELLICO_DROPHANDLER_H + +#include <qobject.h> +#include <kurl.h> + +namespace Tellico { + +class DropHandler : public QObject { +Q_OBJECT + +public: + DropHandler(QObject* parent); + ~DropHandler(); + +protected: + bool eventFilter(QObject* object, QEvent* event); + +private: + bool dragEnter(QDragEnterEvent* event); + bool drop(QDropEvent* event); + bool handleURL(const KURL::List& urls); +}; + +} +#endif diff --git a/src/core/netaccess.cpp b/src/core/netaccess.cpp new file mode 100644 index 0000000..77b6554 --- /dev/null +++ b/src/core/netaccess.cpp @@ -0,0 +1,100 @@ +/*************************************************************************** + copyright : (C) 2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#include "netaccess.h" +#include "../tellico_kernel.h" +#include "../tellico_debug.h" + +#include <kdeversion.h> +#include <kio/job.h> +#include <kio/netaccess.h> +#include <kio/scheduler.h> +#include <kio/previewjob.h> +#include <ktempfile.h> + +#include <qapplication.h> +#include <qfile.h> + +#include <unistd.h> // for unlink() + +using Tellico::NetAccess; + +QStringList* NetAccess::s_tmpFiles = 0; + +bool NetAccess::download(const KURL& url_, QString& target_, QWidget* window_) { + if(url_.isLocalFile()) { + return KIO::NetAccess::download(url_, target_, window_); + } + +// if(!KIO::NetAccess::exists(url_, true, window_)) { +// myDebug() << "NetAccess::download() - does not exist: " << url_ << endl; +// return false; +// } + + if(target_.isEmpty()) { + KTempFile tmpFile; + target_ = tmpFile.name(); + if(!s_tmpFiles) { + s_tmpFiles = new QStringList; + } + s_tmpFiles->append(target_); + } + + KURL dest; + dest.setPath(target_); + + KIO::Job* job = KIO::file_copy(url_, dest, -1, true /*overwrite*/, false /*resume*/, false /*showProgress*/); + return KIO::NetAccess::synchronousRun(job, window_); +} + +void NetAccess::removeTempFile(const QString& name_) { + if(!s_tmpFiles) { + return; + } + if(s_tmpFiles->contains(name_)) { + ::unlink(QFile::encodeName(name_)); + s_tmpFiles->remove(name_); + } +} + +QPixmap NetAccess::filePreview(const KURL& url, int size) { + NetAccess netaccess; + + KURL::List list; + list.append(url); + KIO::Job* previewJob = KIO::filePreview(list, size, size); + connect(previewJob, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)), + &netaccess, SLOT(slotPreview(const KFileItem*, const QPixmap&))); + + KIO::NetAccess::synchronousRun(previewJob, Kernel::self()->widget()); + return netaccess.m_preview; +} + +QPixmap NetAccess::filePreview(KFileItem* item, int size) { + NetAccess netaccess; + + KFileItemList list; + list.append(item); + KIO::Job* previewJob = KIO::filePreview(list, size, size); + connect(previewJob, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)), + &netaccess, SLOT(slotPreview(const KFileItem*, const QPixmap&))); + + KIO::NetAccess::synchronousRun(previewJob, Kernel::self()->widget()); + return netaccess.m_preview; +} + +void NetAccess::slotPreview(const KFileItem*, const QPixmap& pix_) { + m_preview = pix_; +} + +#include "netaccess.moc" diff --git a/src/core/netaccess.h b/src/core/netaccess.h new file mode 100644 index 0000000..df11e0d --- /dev/null +++ b/src/core/netaccess.h @@ -0,0 +1,47 @@ +/*************************************************************************** + copyright : (C) 2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#ifndef TELLICO_NETACCESS_H +#define TELLICO_NETACCESS_H + +#include <qobject.h> +#include <qpixmap.h> + +class KURL; +class KFileItem; +namespace KIO { + class Job; +} + +namespace Tellico { + +class NetAccess : public QObject { +Q_OBJECT + +public: + static bool download(const KURL& u, QString& target, QWidget* window); + static void removeTempFile(const QString& name); + static QPixmap filePreview(const KURL& fileName, int size=196); + static QPixmap filePreview(KFileItem* item, int size=196); + +private slots: + void slotPreview(const KFileItem* item, const QPixmap& pix); + +private: + static QStringList* s_tmpFiles; + + QPixmap m_preview; +}; + +} +#endif diff --git a/src/core/tellico-1-3-update.pl b/src/core/tellico-1-3-update.pl new file mode 100644 index 0000000..9e5ad3b --- /dev/null +++ b/src/core/tellico-1-3-update.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl + +my $input; +my $oldvalue; + +while( $input = <STDIN> ) +{ + chop $input; + + if( $input =~ /^Write Images In File\=(.*)/) + { + $oldvalue=$1; + if( $oldvalue eq "true" ) + { + print "Image Location=ImagesInFile\n"; + } + else + { + print "Image Location=ImageAppDir\n"; + } + } +} + +print "# DELETE [General Options]Write Images In File\n"; diff --git a/src/core/tellico-rename.upd b/src/core/tellico-rename.upd new file mode 100644 index 0000000..5e3cb11 --- /dev/null +++ b/src/core/tellico-rename.upd @@ -0,0 +1,4 @@ +# move old bookcaserc file to tellicorc +Id=tellico-rename +File=bookcaserc,tellicorc +AllGroups diff --git a/src/core/tellico.upd b/src/core/tellico.upd new file mode 100644 index 0000000..18d4220 --- /dev/null +++ b/src/core/tellico.upd @@ -0,0 +1,26 @@ +# +# config updates for Tellico 0.14 +# +Id=tellico-0.14 +File=tellicorc +# +Group=General Options +RemoveKey=Geometry +RemoveKey=Main Window Splitter Sizes +RemoveKey=Show Count +RemoveKey=Show Detail Widget +RemoveKey=Show Toolbar +RemoveKey=ToolBarPos +# +Group=Printing +RemoveKey=Print Grouped Attribute +RemoveKey=Print Fields - book +# +Group=ExportOptions +Key=FormatAttributes,FormatFields +# +# config updates for Tellico 1.3 +Id=tellico-1.3 +File=tellicorc +Options=overwrite +Script=tellico-1-3-update.pl,perl diff --git a/src/core/tellico_config.cpp b/src/core/tellico_config.cpp new file mode 100644 index 0000000..f2050f0 --- /dev/null +++ b/src/core/tellico_config.cpp @@ -0,0 +1,455 @@ +// This file is generated by kconfig_compiler from tellico_config.kcfg. +// All changes you do to this file will be lost. + +#include "tellico_config.h" + +#include <kstaticdeleter.h> + +using namespace Tellico; + +Config *Config::mSelf = 0; +static KStaticDeleter<Config> staticConfigDeleter; + +Config *Config::self() +{ + if ( !mSelf ) { + staticConfigDeleter.setObject( mSelf, new Config() ); + mSelf->readConfig(); + } + + return mSelf; +} + +Config::Config( ) + : KConfigSkeleton( QString::fromLatin1( "tellicorc" ) ) +{ + mSelf = this; + setCurrentGroup( QString::fromLatin1( "TipOfDay" ) ); + + KConfigSkeleton::ItemBool *itemShowTipOfDay; + itemShowTipOfDay = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "RunOnStart" ), mShowTipOfDay, true ); + addItem( itemShowTipOfDay, QString::fromLatin1( "showTipOfDay" ) ); + + setCurrentGroup( QString::fromLatin1( "Main Window Options" ) ); + + QValueList<int> defaultMainSplitterSizes; + + KConfigSkeleton::ItemIntList *itemMainSplitterSizes; + itemMainSplitterSizes = new KConfigSkeleton::ItemIntList( currentGroup(), QString::fromLatin1( "Main Splitter Sizes" ), mMainSplitterSizes, defaultMainSplitterSizes ); + addItem( itemMainSplitterSizes, QString::fromLatin1( "MainSplitterSizes" ) ); + QValueList<int> defaultSecondarySplitterSizes; + + KConfigSkeleton::ItemIntList *itemSecondarySplitterSizes; + itemSecondarySplitterSizes = new KConfigSkeleton::ItemIntList( currentGroup(), QString::fromLatin1( "Secondary Splitter Sizes" ), mSecondarySplitterSizes, defaultSecondarySplitterSizes ); + addItem( itemSecondarySplitterSizes, QString::fromLatin1( "SecondarySplitterSizes" ) ); + + setCurrentGroup( QString::fromLatin1( "Detailed View Options" ) ); + + KConfigSkeleton::ItemInt *itemMaxPixmapWidth; + itemMaxPixmapWidth = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "MaxPixmapWidth" ), mMaxPixmapWidth, 50 ); + addItem( itemMaxPixmapWidth, QString::fromLatin1( "MaxPixmapWidth" ) ); + KConfigSkeleton::ItemInt *itemMaxPixmapHeight; + itemMaxPixmapHeight = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "MaxPixmapHeight" ), mMaxPixmapHeight, 50 ); + addItem( itemMaxPixmapHeight, QString::fromLatin1( "MaxPixmapHeight" ) ); + + setCurrentGroup( QString::fromLatin1( "Group View Options" ) ); + + KConfigSkeleton::ItemInt *itemGroupViewSortColumn; + itemGroupViewSortColumn = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "SortColumn" ), mGroupViewSortColumn, 0 ); + addItem( itemGroupViewSortColumn, QString::fromLatin1( "groupViewSortColumn" ) ); + KConfigSkeleton::ItemBool *itemGroupViewSortAscending; + itemGroupViewSortAscending = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "SortAscending" ), mGroupViewSortAscending, true ); + addItem( itemGroupViewSortAscending, QString::fromLatin1( "groupViewSortAscending" ) ); + + setCurrentGroup( QString::fromLatin1( "Filter View Options" ) ); + + KConfigSkeleton::ItemInt *itemFilterViewSortColumn; + itemFilterViewSortColumn = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "SortColumn" ), mFilterViewSortColumn, 0 ); + addItem( itemFilterViewSortColumn, QString::fromLatin1( "filterViewSortColumn" ) ); + KConfigSkeleton::ItemBool *itemFilterViewSortAscending; + itemFilterViewSortAscending = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "SortAscending" ), mFilterViewSortAscending, true ); + addItem( itemFilterViewSortAscending, QString::fromLatin1( "filterViewSortAscending" ) ); + + setCurrentGroup( QString::fromLatin1( "Loan View Options" ) ); + + KConfigSkeleton::ItemInt *itemLoanViewSortColumn; + itemLoanViewSortColumn = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "SortColumn" ), mLoanViewSortColumn, 0 ); + addItem( itemLoanViewSortColumn, QString::fromLatin1( "loanViewSortColumn" ) ); + KConfigSkeleton::ItemBool *itemLoanViewSortAscending; + itemLoanViewSortAscending = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "SortAscending" ), mLoanViewSortAscending, true ); + addItem( itemLoanViewSortAscending, QString::fromLatin1( "loanViewSortAscending" ) ); + + setCurrentGroup( QString::fromLatin1( "Export Options - Bibtex" ) ); + + KConfigSkeleton::ItemBool *itemUseBraces; + itemUseBraces = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Use Braces" ), mUseBraces, true ); + addItem( itemUseBraces, QString::fromLatin1( "UseBraces" ) ); + + setCurrentGroup( QString::fromLatin1( "General Options" ) ); + + KConfigSkeleton::ItemBool *itemShowGroupWidget; + itemShowGroupWidget = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Show Group Widget" ), mShowGroupWidget, true ); + addItem( itemShowGroupWidget, QString::fromLatin1( "ShowGroupWidget" ) ); + KConfigSkeleton::ItemBool *itemShowEditWidget; + itemShowEditWidget = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Show Edit Widget" ), mShowEditWidget, false ); + addItem( itemShowEditWidget, QString::fromLatin1( "ShowEditWidget" ) ); + KConfigSkeleton::ItemBool *itemShowEntryView; + itemShowEntryView = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Show Entry View" ), mShowEntryView, true ); + addItem( itemShowEntryView, QString::fromLatin1( "ShowEntryView" ) ); + QValueList<KConfigSkeleton::ItemEnum::Choice> valuesImageLocation; + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = QString::fromLatin1( "ImagesInFile" ); + valuesImageLocation.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = QString::fromLatin1( "ImagesInAppDir" ); + valuesImageLocation.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = QString::fromLatin1( "ImagesInLocalDir" ); + valuesImageLocation.append( choice ); + } + KConfigSkeleton::ItemEnum *itemImageLocation; + itemImageLocation = new KConfigSkeleton::ItemEnum( currentGroup(), QString::fromLatin1( "Image Location" ), mImageLocation, valuesImageLocation, ImagesInFile ); + addItem( itemImageLocation, QString::fromLatin1( "ImageLocation" ) ); + KConfigSkeleton::ItemBool *itemAskWriteImagesInFile; + itemAskWriteImagesInFile = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Ask Write Images In File" ), mAskWriteImagesInFile, true ); + addItem( itemAskWriteImagesInFile, QString::fromLatin1( "AskWriteImagesInFile" ) ); + KConfigSkeleton::ItemBool *itemReopenLastFile; + itemReopenLastFile = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Reopen Last File" ), mReopenLastFile, true ); + addItem( itemReopenLastFile, QString::fromLatin1( "ReopenLastFile" ) ); + KConfigSkeleton::ItemBool *itemAutoCapitalization; + itemAutoCapitalization = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Auto Capitalization" ), mAutoCapitalization, true ); + addItem( itemAutoCapitalization, QString::fromLatin1( "AutoCapitalization" ) ); + KConfigSkeleton::ItemBool *itemAutoFormat; + itemAutoFormat = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Auto Format" ), mAutoFormat, true ); + addItem( itemAutoFormat, QString::fromLatin1( "AutoFormat" ) ); + KConfigSkeleton::ItemString *itemLastOpenFile; + itemLastOpenFile = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Last Open File" ), mLastOpenFile ); + addItem( itemLastOpenFile, QString::fromLatin1( "LastOpenFile" ) ); + KConfigSkeleton::ItemString *itemNoCapitalizationString; + itemNoCapitalizationString = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "No Capitalization" ), mNoCapitalizationString, i18n("a,an,and,as,at,but,by,for,from,in,into,nor,of,off,on,onto,or,out,over,the,to,up,with") ); + addItem( itemNoCapitalizationString, QString::fromLatin1( "noCapitalizationString" ) ); + KConfigSkeleton::ItemString *itemArticlesString; + itemArticlesString = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Articles" ), mArticlesString, i18n("the") ); + addItem( itemArticlesString, QString::fromLatin1( "articlesString" ) ); + KConfigSkeleton::ItemString *itemNameSuffixesString; + itemNameSuffixesString = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Name Suffixes" ), mNameSuffixesString, i18n("jr.,jr,iii,iv") ); + addItem( itemNameSuffixesString, QString::fromLatin1( "nameSuffixesString" ) ); + KConfigSkeleton::ItemString *itemSurnamePrefixesString; + itemSurnamePrefixesString = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Surname Prefixes" ), mSurnamePrefixesString, i18n("de,van,der,van der,von") ); + addItem( itemSurnamePrefixesString, QString::fromLatin1( "surnamePrefixesString" ) ); + KConfigSkeleton::ItemInt *itemMaxIconSize; + itemMaxIconSize = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "Max Icon Size" ), mMaxIconSize, 96 ); + addItem( itemMaxIconSize, QString::fromLatin1( "MaxIconSize" ) ); + KConfigSkeleton::ItemInt *itemImageCacheSize; + itemImageCacheSize = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "Image Cache Size" ), mImageCacheSize, (10 * 1024 * 1024) ); + addItem( itemImageCacheSize, QString::fromLatin1( "ImageCacheSize" ) ); + KConfigSkeleton::ItemUInt *itemMaxCustomURLSettings; + itemMaxCustomURLSettings = new KConfigSkeleton::ItemUInt( currentGroup(), QString::fromLatin1( "Max Custom URL Settings" ), mMaxCustomURLSettings, 9 ); + addItem( itemMaxCustomURLSettings, QString::fromLatin1( "MaxCustomURLSettings" ) ); + + setCurrentGroup( QString::fromLatin1( "Printing" ) ); + + KConfigSkeleton::ItemBool *itemPrintFieldHeaders; + itemPrintFieldHeaders = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Print Field Headers" ), mPrintFieldHeaders, true ); + addItem( itemPrintFieldHeaders, QString::fromLatin1( "PrintFieldHeaders" ) ); + KConfigSkeleton::ItemBool *itemPrintFormatted; + itemPrintFormatted = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Print Formatted" ), mPrintFormatted, true ); + addItem( itemPrintFormatted, QString::fromLatin1( "PrintFormatted" ) ); + KConfigSkeleton::ItemBool *itemPrintGrouped; + itemPrintGrouped = new KConfigSkeleton::ItemBool( currentGroup(), QString::fromLatin1( "Print Grouped" ), mPrintGrouped, true ); + addItem( itemPrintGrouped, QString::fromLatin1( "PrintGrouped" ) ); + KConfigSkeleton::ItemInt *itemMaxImageWidth; + itemMaxImageWidth = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "Max Image Width" ), mMaxImageWidth, 50 ); + addItem( itemMaxImageWidth, QString::fromLatin1( "MaxImageWidth" ) ); + KConfigSkeleton::ItemInt *itemMaxImageHeight; + itemMaxImageHeight = new KConfigSkeleton::ItemInt( currentGroup(), QString::fromLatin1( "Max Image Height" ), mMaxImageHeight, 50 ); + addItem( itemMaxImageHeight, QString::fromLatin1( "MaxImageHeight" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - book" ) ); + + KConfigSkeleton::ItemString *itemTemplateBook; + itemTemplateBook = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateBook, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateBook, QString::fromLatin1( "templateBook" ) ); + KConfigSkeleton::ItemFont *itemFontBook; + itemFontBook = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontBook, KGlobalSettings::generalFont() ); + addItem( itemFontBook, QString::fromLatin1( "fontBook" ) ); + KConfigSkeleton::ItemColor *itemBaseColorBook; + itemBaseColorBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorBook, KGlobalSettings::baseColor() ); + addItem( itemBaseColorBook, QString::fromLatin1( "baseColorBook" ) ); + KConfigSkeleton::ItemColor *itemTextColorBook; + itemTextColorBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorBook, KGlobalSettings::textColor() ); + addItem( itemTextColorBook, QString::fromLatin1( "textColorBook" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorBook; + itemHighlightedBaseColorBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorBook, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorBook, QString::fromLatin1( "highlightedBaseColorBook" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorBook; + itemHighlightedTextColorBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorBook, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorBook, QString::fromLatin1( "highlightedTextColorBook" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - video" ) ); + + KConfigSkeleton::ItemString *itemTemplateVideo; + itemTemplateVideo = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateVideo, QString::fromLatin1( "Video" ) ); + addItem( itemTemplateVideo, QString::fromLatin1( "templateVideo" ) ); + KConfigSkeleton::ItemFont *itemFontVideo; + itemFontVideo = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontVideo, KGlobalSettings::generalFont() ); + addItem( itemFontVideo, QString::fromLatin1( "fontVideo" ) ); + KConfigSkeleton::ItemColor *itemBaseColorVideo; + itemBaseColorVideo = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorVideo, KGlobalSettings::baseColor() ); + addItem( itemBaseColorVideo, QString::fromLatin1( "baseColorVideo" ) ); + KConfigSkeleton::ItemColor *itemTextColorVideo; + itemTextColorVideo = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorVideo, KGlobalSettings::textColor() ); + addItem( itemTextColorVideo, QString::fromLatin1( "textColorVideo" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorVideo; + itemHighlightedBaseColorVideo = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorVideo, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorVideo, QString::fromLatin1( "highlightedBaseColorVideo" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorVideo; + itemHighlightedTextColorVideo = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorVideo, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorVideo, QString::fromLatin1( "highlightedTextColorVideo" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - album" ) ); + + KConfigSkeleton::ItemString *itemTemplateAlbum; + itemTemplateAlbum = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateAlbum, QString::fromLatin1( "Album" ) ); + addItem( itemTemplateAlbum, QString::fromLatin1( "templateAlbum" ) ); + KConfigSkeleton::ItemFont *itemFontAlbum; + itemFontAlbum = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontAlbum, KGlobalSettings::generalFont() ); + addItem( itemFontAlbum, QString::fromLatin1( "fontAlbum" ) ); + KConfigSkeleton::ItemColor *itemBaseColorAlbum; + itemBaseColorAlbum = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorAlbum, KGlobalSettings::baseColor() ); + addItem( itemBaseColorAlbum, QString::fromLatin1( "baseColorAlbum" ) ); + KConfigSkeleton::ItemColor *itemTextColorAlbum; + itemTextColorAlbum = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorAlbum, KGlobalSettings::textColor() ); + addItem( itemTextColorAlbum, QString::fromLatin1( "textColorAlbum" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorAlbum; + itemHighlightedBaseColorAlbum = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorAlbum, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorAlbum, QString::fromLatin1( "highlightedBaseColorAlbum" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorAlbum; + itemHighlightedTextColorAlbum = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorAlbum, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorAlbum, QString::fromLatin1( "highlightedTextColorAlbum" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - bibtex" ) ); + + KConfigSkeleton::ItemPath *itemLyxpipe; + itemLyxpipe = new KConfigSkeleton::ItemPath( currentGroup(), QString::fromLatin1( "lyxpipe" ), mLyxpipe, QString::fromLatin1( "$HOME/.lyx/lyxpipe" ) ); + addItem( itemLyxpipe, QString::fromLatin1( "lyxpipe" ) ); + KConfigSkeleton::ItemString *itemTemplateBibtex; + itemTemplateBibtex = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateBibtex, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateBibtex, QString::fromLatin1( "templateBibtex" ) ); + KConfigSkeleton::ItemFont *itemFontBibtex; + itemFontBibtex = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontBibtex, KGlobalSettings::generalFont() ); + addItem( itemFontBibtex, QString::fromLatin1( "fontBibtex" ) ); + KConfigSkeleton::ItemColor *itemBaseColorBibtex; + itemBaseColorBibtex = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorBibtex, KGlobalSettings::baseColor() ); + addItem( itemBaseColorBibtex, QString::fromLatin1( "baseColorBibtex" ) ); + KConfigSkeleton::ItemColor *itemTextColorBibtex; + itemTextColorBibtex = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorBibtex, KGlobalSettings::textColor() ); + addItem( itemTextColorBibtex, QString::fromLatin1( "textColorBibtex" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorBibtex; + itemHighlightedBaseColorBibtex = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorBibtex, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorBibtex, QString::fromLatin1( "highlightedBaseColorBibtex" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorBibtex; + itemHighlightedTextColorBibtex = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorBibtex, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorBibtex, QString::fromLatin1( "highlightedTextColorBibtex" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - comic" ) ); + + KConfigSkeleton::ItemString *itemTemplateComicBook; + itemTemplateComicBook = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateComicBook, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateComicBook, QString::fromLatin1( "templateComicBook" ) ); + KConfigSkeleton::ItemFont *itemFontComicBook; + itemFontComicBook = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontComicBook, KGlobalSettings::generalFont() ); + addItem( itemFontComicBook, QString::fromLatin1( "fontComicBook" ) ); + KConfigSkeleton::ItemColor *itemBaseColorComicBook; + itemBaseColorComicBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorComicBook, KGlobalSettings::baseColor() ); + addItem( itemBaseColorComicBook, QString::fromLatin1( "baseColorComicBook" ) ); + KConfigSkeleton::ItemColor *itemTextColorComicBook; + itemTextColorComicBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorComicBook, KGlobalSettings::textColor() ); + addItem( itemTextColorComicBook, QString::fromLatin1( "textColorComicBook" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorComicBook; + itemHighlightedBaseColorComicBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorComicBook, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorComicBook, QString::fromLatin1( "highlightedBaseColorComicBook" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorComicBook; + itemHighlightedTextColorComicBook = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorComicBook, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorComicBook, QString::fromLatin1( "highlightedTextColorComicBook" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - wine" ) ); + + KConfigSkeleton::ItemString *itemTemplateWine; + itemTemplateWine = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateWine, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateWine, QString::fromLatin1( "templateWine" ) ); + KConfigSkeleton::ItemFont *itemFontWine; + itemFontWine = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontWine, KGlobalSettings::generalFont() ); + addItem( itemFontWine, QString::fromLatin1( "fontWine" ) ); + KConfigSkeleton::ItemColor *itemBaseColorWine; + itemBaseColorWine = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorWine, KGlobalSettings::baseColor() ); + addItem( itemBaseColorWine, QString::fromLatin1( "baseColorWine" ) ); + KConfigSkeleton::ItemColor *itemTextColorWine; + itemTextColorWine = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorWine, KGlobalSettings::textColor() ); + addItem( itemTextColorWine, QString::fromLatin1( "textColorWine" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorWine; + itemHighlightedBaseColorWine = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorWine, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorWine, QString::fromLatin1( "highlightedBaseColorWine" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorWine; + itemHighlightedTextColorWine = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorWine, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorWine, QString::fromLatin1( "highlightedTextColorWine" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - coin" ) ); + + KConfigSkeleton::ItemString *itemTemplateCoin; + itemTemplateCoin = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateCoin, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateCoin, QString::fromLatin1( "templateCoin" ) ); + KConfigSkeleton::ItemFont *itemFontCoin; + itemFontCoin = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontCoin, KGlobalSettings::generalFont() ); + addItem( itemFontCoin, QString::fromLatin1( "fontCoin" ) ); + KConfigSkeleton::ItemColor *itemBaseColorCoin; + itemBaseColorCoin = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorCoin, KGlobalSettings::baseColor() ); + addItem( itemBaseColorCoin, QString::fromLatin1( "baseColorCoin" ) ); + KConfigSkeleton::ItemColor *itemTextColorCoin; + itemTextColorCoin = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorCoin, KGlobalSettings::textColor() ); + addItem( itemTextColorCoin, QString::fromLatin1( "textColorCoin" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorCoin; + itemHighlightedBaseColorCoin = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorCoin, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorCoin, QString::fromLatin1( "highlightedBaseColorCoin" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorCoin; + itemHighlightedTextColorCoin = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorCoin, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorCoin, QString::fromLatin1( "highlightedTextColorCoin" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - stamp" ) ); + + KConfigSkeleton::ItemString *itemTemplateStamp; + itemTemplateStamp = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateStamp, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateStamp, QString::fromLatin1( "templateStamp" ) ); + KConfigSkeleton::ItemFont *itemFontStamp; + itemFontStamp = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontStamp, KGlobalSettings::generalFont() ); + addItem( itemFontStamp, QString::fromLatin1( "fontStamp" ) ); + KConfigSkeleton::ItemColor *itemBaseColorStamp; + itemBaseColorStamp = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorStamp, KGlobalSettings::baseColor() ); + addItem( itemBaseColorStamp, QString::fromLatin1( "baseColorStamp" ) ); + KConfigSkeleton::ItemColor *itemTextColorStamp; + itemTextColorStamp = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorStamp, KGlobalSettings::textColor() ); + addItem( itemTextColorStamp, QString::fromLatin1( "textColorStamp" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorStamp; + itemHighlightedBaseColorStamp = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorStamp, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorStamp, QString::fromLatin1( "highlightedBaseColorStamp" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorStamp; + itemHighlightedTextColorStamp = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorStamp, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorStamp, QString::fromLatin1( "highlightedTextColorStamp" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - card" ) ); + + KConfigSkeleton::ItemString *itemTemplateCard; + itemTemplateCard = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateCard, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateCard, QString::fromLatin1( "templateCard" ) ); + KConfigSkeleton::ItemFont *itemFontCard; + itemFontCard = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontCard, KGlobalSettings::generalFont() ); + addItem( itemFontCard, QString::fromLatin1( "fontCard" ) ); + KConfigSkeleton::ItemColor *itemBaseColorCard; + itemBaseColorCard = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorCard, KGlobalSettings::baseColor() ); + addItem( itemBaseColorCard, QString::fromLatin1( "baseColorCard" ) ); + KConfigSkeleton::ItemColor *itemTextColorCard; + itemTextColorCard = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorCard, KGlobalSettings::textColor() ); + addItem( itemTextColorCard, QString::fromLatin1( "textColorCard" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorCard; + itemHighlightedBaseColorCard = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorCard, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorCard, QString::fromLatin1( "highlightedBaseColorCard" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorCard; + itemHighlightedTextColorCard = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorCard, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorCard, QString::fromLatin1( "highlightedTextColorCard" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - game" ) ); + + KConfigSkeleton::ItemString *itemTemplateGame; + itemTemplateGame = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateGame, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateGame, QString::fromLatin1( "templateGame" ) ); + KConfigSkeleton::ItemFont *itemFontGame; + itemFontGame = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontGame, KGlobalSettings::generalFont() ); + addItem( itemFontGame, QString::fromLatin1( "fontGame" ) ); + KConfigSkeleton::ItemColor *itemBaseColorGame; + itemBaseColorGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorGame, KGlobalSettings::baseColor() ); + addItem( itemBaseColorGame, QString::fromLatin1( "baseColorGame" ) ); + KConfigSkeleton::ItemColor *itemTextColorGame; + itemTextColorGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorGame, KGlobalSettings::textColor() ); + addItem( itemTextColorGame, QString::fromLatin1( "textColorGame" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorGame; + itemHighlightedBaseColorGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorGame, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorGame, QString::fromLatin1( "highlightedBaseColorGame" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorGame; + itemHighlightedTextColorGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorGame, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorGame, QString::fromLatin1( "highlightedTextColorGame" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - file" ) ); + + KConfigSkeleton::ItemString *itemTemplateFile; + itemTemplateFile = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateFile, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateFile, QString::fromLatin1( "templateFile" ) ); + KConfigSkeleton::ItemFont *itemFontFile; + itemFontFile = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontFile, KGlobalSettings::generalFont() ); + addItem( itemFontFile, QString::fromLatin1( "fontFile" ) ); + KConfigSkeleton::ItemColor *itemBaseColorFile; + itemBaseColorFile = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorFile, KGlobalSettings::baseColor() ); + addItem( itemBaseColorFile, QString::fromLatin1( "baseColorFile" ) ); + KConfigSkeleton::ItemColor *itemTextColorFile; + itemTextColorFile = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorFile, KGlobalSettings::textColor() ); + addItem( itemTextColorFile, QString::fromLatin1( "textColorFile" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorFile; + itemHighlightedBaseColorFile = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorFile, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorFile, QString::fromLatin1( "highlightedBaseColorFile" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorFile; + itemHighlightedTextColorFile = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorFile, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorFile, QString::fromLatin1( "highlightedTextColorFile" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - boardgame" ) ); + + KConfigSkeleton::ItemString *itemTemplateBoardGame; + itemTemplateBoardGame = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateBoardGame, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateBoardGame, QString::fromLatin1( "templateBoardGame" ) ); + KConfigSkeleton::ItemFont *itemFontBoardGame; + itemFontBoardGame = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontBoardGame, KGlobalSettings::generalFont() ); + addItem( itemFontBoardGame, QString::fromLatin1( "fontBoardGame" ) ); + KConfigSkeleton::ItemColor *itemBaseColorBoardGame; + itemBaseColorBoardGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorBoardGame, KGlobalSettings::baseColor() ); + addItem( itemBaseColorBoardGame, QString::fromLatin1( "baseColorBoardGame" ) ); + KConfigSkeleton::ItemColor *itemTextColorBoardGame; + itemTextColorBoardGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorBoardGame, KGlobalSettings::textColor() ); + addItem( itemTextColorBoardGame, QString::fromLatin1( "textColorBoardGame" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorBoardGame; + itemHighlightedBaseColorBoardGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorBoardGame, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorBoardGame, QString::fromLatin1( "highlightedBaseColorBoardGame" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorBoardGame; + itemHighlightedTextColorBoardGame = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorBoardGame, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorBoardGame, QString::fromLatin1( "highlightedTextColorBoardGame" ) ); + + setCurrentGroup( QString::fromLatin1( "Options - entry" ) ); + + KConfigSkeleton::ItemString *itemTemplateBase; + itemTemplateBase = new KConfigSkeleton::ItemString( currentGroup(), QString::fromLatin1( "Entry Template" ), mTemplateBase, QString::fromLatin1( "Fancy" ) ); + addItem( itemTemplateBase, QString::fromLatin1( "templateBase" ) ); + KConfigSkeleton::ItemFont *itemFontBase; + itemFontBase = new KConfigSkeleton::ItemFont( currentGroup(), QString::fromLatin1( "Template Font" ), mFontBase, KGlobalSettings::generalFont() ); + addItem( itemFontBase, QString::fromLatin1( "fontBase" ) ); + KConfigSkeleton::ItemColor *itemBaseColorBase; + itemBaseColorBase = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Base Color" ), mBaseColorBase, KGlobalSettings::baseColor() ); + addItem( itemBaseColorBase, QString::fromLatin1( "baseColorBase" ) ); + KConfigSkeleton::ItemColor *itemTextColorBase; + itemTextColorBase = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Text Color" ), mTextColorBase, KGlobalSettings::textColor() ); + addItem( itemTextColorBase, QString::fromLatin1( "textColorBase" ) ); + KConfigSkeleton::ItemColor *itemHighlightedBaseColorBase; + itemHighlightedBaseColorBase = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlight Color" ), mHighlightedBaseColorBase, KGlobalSettings::highlightColor() ); + addItem( itemHighlightedBaseColorBase, QString::fromLatin1( "highlightedBaseColorBase" ) ); + KConfigSkeleton::ItemColor *itemHighlightedTextColorBase; + itemHighlightedTextColorBase = new KConfigSkeleton::ItemColor( currentGroup(), QString::fromLatin1( "Template Highlighted Text Color" ), mHighlightedTextColorBase, KGlobalSettings::highlightedTextColor() ); + addItem( itemHighlightedTextColorBase, QString::fromLatin1( "highlightedTextColorBase" ) ); +} + +Config::~Config() +{ + if ( mSelf == this ) + staticConfigDeleter.setObject( mSelf, 0, false ); +} + diff --git a/src/core/tellico_config.kcfg b/src/core/tellico_config.kcfg new file mode 100644 index 0000000..8b4ed39 --- /dev/null +++ b/src/core/tellico_config.kcfg @@ -0,0 +1,477 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + +<kcfgfile name="tellicorc"/> +<include>klocale.h</include> + +<group name="TipOfDay"> + <entry key="RunOnStart" type="Bool" name="showTipOfDay"> + <default>true</default> + </entry> +</group> + +<group name="Main Window Options"> + <entry key="Main Splitter Sizes" type="IntList"/> + <entry key="Secondary Splitter Sizes" type="IntList"/> +</group> + +<group name="Detailed View Options"> + <entry key="MaxPixmapWidth" type="Int"> + <default>50</default> + </entry> + <entry key="MaxPixmapHeight" type="Int"> + <default>50</default> + </entry> +</group> + +<group name="Group View Options"> + <entry key="SortColumn" type="Int" name="groupViewSortColumn"> + <default>0</default> + </entry> + <entry key="SortAscending" type="Bool" name="groupViewSortAscending"> + <default>true</default> + </entry> +</group> + +<group name="Filter View Options"> + <entry key="SortColumn" type="Int" name="filterViewSortColumn"> + <default>0</default> + </entry> + <entry key="SortAscending" type="Bool" name="filterViewSortAscending"> + <default>true</default> + </entry> +</group> + +<group name="Loan View Options"> + <entry key="SortColumn" type="Int" name="loanViewSortColumn"> + <default>0</default> + </entry> + <entry key="SortAscending" type="Bool" name="loanViewSortAscending"> + <default>true</default> + </entry> +</group> + +<group name="Export Options - Bibtex"> + <entry key="Use Braces" type="Bool"> + <default>true</default> + </entry> +</group> + +<group name="General Options"> + <entry key="Show Group Widget" type="Bool"> + <default>true</default> + </entry> + <entry key="Show Edit Widget" type="Bool"> + <default>false</default> + </entry> + <entry key="Show Entry View" type="Bool"> + <default>true</default> + </entry> + <entry key="Image Location" type="Enum"> + <choices> + <choice name="ImagesInFile"/> + <choice name="ImagesInAppDir"/> + <choice name="ImagesInLocalDir"/> + </choices> + <default>ImagesInFile</default> + </entry> + <entry key="Ask Write Images In File" type="Bool"> + <default>true</default> + </entry> + <entry key="Reopen Last File" type="Bool"> + <default>true</default> + </entry> + <entry key="Auto Capitalization" type="Bool"> + <default>true</default> + </entry> + <entry key="Auto Format" type="Bool"> + <default>true</default> + </entry> + <entry key="Last Open File" type="String"/> + <entry key="No Capitalization" name="noCapitalizationString" type="String"> + <default code="true">i18n("a,an,and,as,at,but,by,for,from,in,into,nor,of,off,on,onto,or,out,over,the,to,up,with")</default> + </entry> + <entry key="Articles" name="articlesString" type="String"> + <default code="true">i18n("the")</default> + </entry> + <entry key="Name Suffixes" name="nameSuffixesString" type="String"> + <default code="true">i18n("jr.,jr,iii,iv")</default> + </entry> + <entry key="Surname Prefixes" name="surnamePrefixesString" type="String"> + <default code="true">i18n("de,van,der,van der,von")</default> + </entry> + <entry key="Max Icon Size" type="Int"> + <default>96</default> + </entry> + <entry key="Image Cache Size" type="Int"> + <default code="true">(10 * 1024 * 1024)</default> + </entry> + <entry key="Max Custom URL Settings" type="UInt"> + <default>9</default> + </entry> +</group> + +<group name="Printing"> + <entry key="Print Field Headers" type="Bool"> + <default>true</default> + </entry> + <entry key="Print Formatted" type="Bool"> + <default>true</default> + </entry> + <entry key="Print Grouped" type="Bool"> + <default>true</default> + </entry> + <entry key="Max Image Width" type="Int"> + <default>50</default> + </entry> + <entry key="Max Image Height" type="Int"> + <default>50</default> + </entry> +</group> + +<group name="Options - book"> + <entry key="Entry Template" type="String" name="templateBook"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontBook"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorBook"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorBook"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorBook"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorBook"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - video"> + <entry key="Entry Template" type="String" name="templateVideo"> + <default>Video</default> + </entry> + <entry key="Template Font" type="Font" name="fontVideo"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorVideo"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorVideo"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorVideo"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorVideo"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - album"> + <entry key="Entry Template" type="String" name="templateAlbum"> + <default>Album</default> + </entry> + <entry key="Template Font" type="Font" name="fontAlbum"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorAlbum"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorAlbum"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorAlbum"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorAlbum"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - bibtex"> + <entry key="lyxpipe" type="Path"> + <default>$HOME/.lyx/lyxpipe</default> + </entry> + <entry key="Entry Template" type="String" name="templateBibtex"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontBibtex"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorBibtex"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorBibtex"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorBibtex"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorBibtex"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - comic"> + <entry key="Entry Template" type="String" name="templateComicBook"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontComicBook"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorComicBook"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorComicBook"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorComicBook"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorComicBook"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - wine"> + <entry key="Entry Template" type="String" name="templateWine"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontWine"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorWine"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorWine"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorWine"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorWine"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - coin"> + <entry key="Entry Template" type="String" name="templateCoin"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontCoin"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorCoin"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorCoin"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorCoin"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorCoin"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - stamp"> + <entry key="Entry Template" type="String" name="templateStamp"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontStamp"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorStamp"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorStamp"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorStamp"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorStamp"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - card"> + <entry key="Entry Template" type="String" name="templateCard"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontCard"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorCard"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorCard"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorCard"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorCard"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - game"> + <entry key="Entry Template" type="String" name="templateGame"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontGame"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorGame"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorGame"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorGame"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorGame"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - file"> + <entry key="Entry Template" type="String" name="templateFile"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontFile"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorFile"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorFile"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorFile"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorFile"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - boardgame"> + <entry key="Entry Template" type="String" name="templateBoardGame"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontBoardGame"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorBoardGame"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorBoardGame"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorBoardGame"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorBoardGame"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +<group name="Options - entry"> + <entry key="Entry Template" type="String" name="templateBase"> + <default>Fancy</default> + </entry> + <entry key="Template Font" type="Font" name="fontBase"> + <label>Template font</label> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + <entry key="Template Base Color" type="Color" name="baseColorBase"> + <label>Template background color</label> + <default code="true">KGlobalSettings::baseColor()</default> + </entry> + <entry key="Template Text Color" type="Color" name="textColorBase"> + <label>Template text color</label> + <default code="true">KGlobalSettings::textColor()</default> + </entry> + <entry key="Template Highlight Color" type="Color" name="highlightedBaseColorBase"> + <label>Template highlight color</label> + <default code="true">KGlobalSettings::highlightColor()</default> + </entry> + <entry key="Template Highlighted Text Color" type="Color" name="highlightedTextColorBase"> + <label>Template highlighted text color</label> + <default code="true">KGlobalSettings::highlightedTextColor()</default> + </entry> +</group> + +</kcfg> diff --git a/src/core/tellico_config.kcfgc b/src/core/tellico_config.kcfgc new file mode 100644 index 0000000..7cf7c9c --- /dev/null +++ b/src/core/tellico_config.kcfgc @@ -0,0 +1,9 @@ +# Code generation options for kconfig_compiler +File=tellico_config.kcfg +ClassName=Config +NameSpace=Tellico +Singleton=true +Mutators=true +MemberVariables=private +CustomAdditions=true +GlobalEnums=true diff --git a/src/core/tellico_config_addons.cpp b/src/core/tellico_config_addons.cpp new file mode 100644 index 0000000..9b388d5 --- /dev/null +++ b/src/core/tellico_config_addons.cpp @@ -0,0 +1,171 @@ +/*************************************************************************** + copyright : (C) 2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#include "tellico_config.h" +#include "../collection.h" + +#define COLL Data::Collection:: +#define CLASS Config:: +#define P1 ( +#define P2 ) +#define CASE1(a,b) case COLL b: return CLASS a ## b P1 P2; +#define CASE2(a,b,c) case COLL b: CLASS a ## b P1 c P2; break; +#define GET(name,type) \ + CASE1(name,type) +#define SET(name,type,value) \ + CASE2(name,type,value) +#define ALL_GET(name) \ + GET(name, Base) \ + GET(name, Book) \ + GET(name, Video) \ + GET(name, Album) \ + GET(name, Bibtex) \ + GET(name, ComicBook) \ + GET(name, Wine) \ + GET(name, Coin) \ + GET(name, Stamp) \ + GET(name, Card) \ + GET(name, Game) \ + GET(name, File) \ + GET(name, BoardGame) +#define ALL_SET(name,value) \ + SET(name, Base, value) \ + SET(name, Book, value) \ + SET(name, Video, value) \ + SET(name, Album, value) \ + SET(name, Bibtex, value) \ + SET(name, ComicBook, value) \ + SET(name, Wine, value) \ + SET(name, Coin, value) \ + SET(name, Stamp, value) \ + SET(name, Card, value) \ + SET(name, Game, value) \ + SET(name, File, value) \ + SET(name, BoardGame, value) + +namespace { + static const QRegExp commaSplit = QRegExp(QString::fromLatin1("\\s*,\\s*")); +} + +using Tellico::Config; + +void Config::deleteAndReset() { + delete mSelf; + mSelf = 0; +} + +QStringList Config::noCapitalizationList() { + return QStringList::split(commaSplit, Config::noCapitalizationString()); +} + +QStringList Config::articleList() { + return QStringList::split(commaSplit, Config::articlesString()); +} + +QStringList Config::nameSuffixList() { + return QStringList::split(commaSplit, Config::nameSuffixesString()); +} + +QStringList Config::surnamePrefixList() { + return QStringList::split(commaSplit, Config::surnamePrefixesString()); +} + + +QString Config::templateName(int type_) { + switch(type_) { + ALL_GET(template); + } + return QString(); +} + +QFont Config::templateFont(int type_) { + switch(type_) { + ALL_GET(font); + } + return QFont(); +} + +QColor Config::templateBaseColor(int type_) { + switch(type_) { + ALL_GET(baseColor) + } + return QColor(); +} + +QColor Config::templateTextColor(int type_) { + switch(type_) { + ALL_GET(textColor) + } + return QColor(); +} + +QColor Config::templateHighlightedBaseColor(int type_) { + switch(type_) { + ALL_GET(highlightedBaseColor) + } + return QColor(); +} + +QColor Config::templateHighlightedTextColor(int type_) { + switch(type_) { + ALL_GET(highlightedTextColor) + } + return QColor(); +} + +void Config::setTemplateName(int type_, const QString& name_) { + switch(type_) { + ALL_SET(setTemplate,name_) + } +} + +void Config::setTemplateFont(int type_, const QFont& font_) { + switch(type_) { + ALL_SET(setFont,font_) + } +} + +void Config::setTemplateBaseColor(int type_, const QColor& color_) { + switch(type_) { + ALL_SET(setBaseColor,color_) + } +} + +void Config::setTemplateTextColor(int type_, const QColor& color_) { + switch(type_) { + ALL_SET(setTextColor,color_) + } +} + +void Config::setTemplateHighlightedBaseColor(int type_, const QColor& color_) { + switch(type_) { + ALL_SET(setHighlightedBaseColor,color_) + } +} + +void Config::setTemplateHighlightedTextColor(int type_, const QColor& color_) { + switch(type_) { + ALL_SET(setHighlightedTextColor,color_) + } +} + +#undef COLL +#undef CLASS +#undef P1 +#undef P2 +#undef CASE1 +#undef CASE2 +#undef GET +#undef SET +#undef ALL_GET +#undef ALL_SET diff --git a/src/core/tellico_config_addons.h b/src/core/tellico_config_addons.h new file mode 100644 index 0000000..7573257 --- /dev/null +++ b/src/core/tellico_config_addons.h @@ -0,0 +1,36 @@ +/*************************************************************************** + copyright : (C) 2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +// this file gets included by tellico_config.h + +public: + static void deleteAndReset(); + + static QStringList noCapitalizationList(); + static QStringList articleList(); + static QStringList nameSuffixList(); + static QStringList surnamePrefixList(); + + static QString templateName(int type); + static QFont templateFont(int type); + static QColor templateBaseColor(int type); + static QColor templateTextColor(int type); + static QColor templateHighlightedBaseColor(int type); + static QColor templateHighlightedTextColor(int type); + + static void setTemplateName(int type, const QString& name); + static void setTemplateFont(int type, const QFont& font); + static void setTemplateBaseColor(int type, const QColor& color); + static void setTemplateTextColor(int type, const QColor& color); + static void setTemplateHighlightedBaseColor(int type, const QColor& color); + static void setTemplateHighlightedTextColor(int type, const QColor& color); |