1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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 <kapplication.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
namespace {
static const char* description = I18N_NOOP("Tellico - a collection manager for TDE");
static const char* version = VERSION;
static KCmdLineOptions options[] = {
{ "nofile", I18N_NOOP("Do not reopen the last open file"), 0 },
{ "bibtex", I18N_NOOP("Import <filename> as a bibtex file"), 0 },
{ "mods", I18N_NOOP("Import <filename> as a MODS file"), 0 },
{ "ris", I18N_NOOP("Import <filename> 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);
TDECmdLineArgs::init(argc, argv, &aboutData);
TDECmdLineArgs::addCmdLineOptions(options);
TDEApplication app;
if(app.isRestored()) {
RESTORE(Tellico::MainWindow);
} else {
Tellico::MainWindow* tellico = new Tellico::MainWindow();
tellico->show();
tellico->slotShowTipOfDay(false);
TDECmdLineArgs* args = TDECmdLineArgs::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();
}
|