From e38d2351b83fa65c66ccde443777647ef5cb6cff Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 1 Mar 2010 19:17:32 +0000 Subject: Added KDE3 version of Tellico git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/main.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/main.cpp (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f0b57c4 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,88 @@ +/*************************************************************************** + copyright : (C) 2001-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 "mainwindow.h" +#include "translators/translators.h" // needed for file type enum + +#include +#include +#include +#include + +namespace { + static const char* description = I18N_NOOP("Tellico - a collection manager for KDE"); + static const char* version = VERSION; + + static KCmdLineOptions options[] = { + { "nofile", I18N_NOOP("Do not reopen the last open file"), 0 }, + { "bibtex", I18N_NOOP("Import as a bibtex file"), 0 }, + { "mods", I18N_NOOP("Import as a MODS file"), 0 }, + { "ris", I18N_NOOP("Import as a RIS file"), 0 }, + { "+[filename]", I18N_NOOP("File to open"), 0 }, + KCmdLineLastOption + }; +} + +int main(int argc, char* argv[]) { + KAboutData aboutData("tellico", "Tellico", + version, description, KAboutData::License_GPL, + "(c) 2001-2007, Robby Stephenson", 0, + "http://www.periapsis.org/tellico/", "tellico-users@forge.novell.com"); + aboutData.addAuthor("Robby Stephenson", 0, "robby@periapsis.org"); + aboutData.addCredit("Mathias Monnerville", I18N_NOOP("Data source scripts"), + 0, 0); + aboutData.addCredit("Virginie Quesnay", I18N_NOOP("Icons"), + 0, 0); + aboutData.addCredit("Greg Ward", I18N_NOOP("Author of btparse library"), + 0, "http://www.gerg.ca"); + aboutData.addCredit("Amarok", I18N_NOOP("Code examples and general inspiration"), + 0, "http://amarok.kde.org"); + aboutData.addCredit("Robert Gamble", I18N_NOOP("Author of libcsv library"), + 0, 0); + aboutData.addCredit("Valentin Lavrinenko", I18N_NOOP("Author of rtf2html library"), + 0, 0); + + KCmdLineArgs::init(argc, argv, &aboutData); + KCmdLineArgs::addCmdLineOptions(options); + + KApplication app; + + if(app.isRestored()) { + RESTORE(Tellico::MainWindow); + } else { + Tellico::MainWindow* tellico = new Tellico::MainWindow(); + tellico->show(); + tellico->slotShowTipOfDay(false); + + KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + if(args->count() > 0) { + if(args->isSet("bibtex")) { + tellico->importFile(Tellico::Import::Bibtex, args->url(0), Tellico::Import::Replace); + } else if(args->isSet("mods")) { + tellico->importFile(Tellico::Import::MODS, args->url(0), Tellico::Import::Replace); + } else if(args->isSet("ris")) { + tellico->importFile(Tellico::Import::RIS, args->url(0), Tellico::Import::Replace); + } else { + tellico->slotFileOpen(args->url(0)); + } + } else { + // bit of a hack, I just want the --nofile option + // if --nofile is NOT passed, then the file option is set + // is it's set, then go ahead and check for opening previous file + tellico->initFileOpen(!args->isSet("file")); + } + args->clear(); // some memory savings + } + + return app.exec(); +} -- cgit v1.2.1