1
/***************************************************************************
2
* Copyright (C) 2004-2009 by Thomas Fischer *
3
* fischer@unix-ag.uni-kl.de *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
21
// #define UNIQUEAPP 1
26
#include <kuniqueapplication.h>
28
#include <kapplication.h>
30
#include <kmessagebox.h>
31
#include <kaboutdata.h>
32
#include <kcmdlineargs.h>
35
#include <kstandarddirs.h>
37
#include "kbibtexshell.h"
39
static const char description[] =
40
I18N_NOOP( "A BibTeX editor for KDE" );
42
static const char version[] = "0.2.3.90";
44
static KCmdLineOptions options[] =
46
{ "+[URL]", I18N_NOOP( "Document to open." ), 0
52
class KBibTeXApplication: public KUniqueApplication
54
class KBibTeXApplication: public KApplication
59
KBibTeXApplication() : KUniqueApplication()
67
KBibTeXApplication() : KApplication()
70
// see if we are starting with session management
73
RESTORE( KBibTeXShell );
77
// no session.. just start up normally
78
KCmdLineArgs * args = KCmdLineArgs::parsedArgs();
80
if ( args->count() == 0 )
82
KBibTeXShell * shell = new KBibTeXShell();
87
for ( int i = 0 ; i < args->count(); i++ )
89
KBibTeXShell *shell = new KBibTeXShell();
90
if ( shell->openURL( args->url( i ) ) )
94
kdDebug() << "Couldn't open file " << args->url( i ).path() << endl;
95
KMessageBox::error( NULL, i18n( "Could not open file '%1'." ).arg( args->url( i ).path() ) );
109
int main( int argc, char **argv )
111
KAboutData about( "kbibtex", I18N_NOOP( "KBibTeX" ), version, description,
112
KAboutData::License_GPL, "(C) 2004-2009 Thomas Fischer", 0, "http://www.unix-ag.uni-kl.de/~fischer/kbibtex/", "fischer@unix-ag.uni-kl.de" );
113
about.addAuthor( "Thomas Fischer", 0, "fischer@unix-ag.uni-kl.de" );
114
about.setTranslator( I18N_NOOP( "NAME OF TRANSLATORS" ), I18N_NOOP( "EMAIL OF TRANSLATORS" ) );
115
KCmdLineArgs::init( argc, argv, &about );
116
KCmdLineArgs::addCmdLineOptions( options );
119
if ( !KUniqueApplication::start() )
121
kdDebug() << "Reusing existing KBibTeX instance" << endl;
126
KBibTeXApplication app;