summaryrefslogtreecommitdiffstats
path: root/kbugbuster/main.cpp
blob: edf104bec735a3b43da7bdb38b5110a21fe084b4 (plain)
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
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : zo mrt 18 17:12:24 CET 2001
    copyright            : (C) 2001 by Martijn Klingens
    email                : klingens@kde.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <dcopclient.h>

#include "gui/kbbmainwindow.h"
#include "bugsystem.h"
#include "kbbprefs.h"

static const char description[] =
    I18N_NOOP("KBugBuster");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE

static const KCmdLineOptions options[] =
{
  {"d", 0, 0},
  {"disconnected", I18N_NOOP("Start in disconnected mode"), 0},
  {"pkg", 0, 0},
  {"package <pkg>", I18N_NOOP("Start with the buglist for <package>"), 0},
  {"bug <br>", I18N_NOOP("Start with bug report <br>"), 0},
  KCmdLineLastOption
};

int main(int argc, char *argv[])
{
    KAboutData aboutData( "kbugbuster", I18N_NOOP( "KBugBuster" ),
        VERSION, description, KAboutData::License_GPL,
        I18N_NOOP("(c) 2001,2002,2003 the KBugBuster authors") );
    aboutData.addAuthor( "Martijn Klingens", 0, "klingens@kde.org" );
    aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );
    aboutData.addAuthor( "Simon Hausmann", 0, "hausmann@kde.org" );
    aboutData.addAuthor( "David Faure", 0, "faure@kde.org" );
    TDECmdLineArgs::init( argc, argv, &aboutData );
    TDECmdLineArgs::addCmdLineOptions( options );

    KApplication app;

    app.dcopClient()->attach();

    TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
    if (args->isSet("disconnected")) {
        BugSystem::self()->setDisconnected( true );
    }

    if ( app.isRestored() )
    {
        RESTORE( KBBMainWindow );
    }
    else 
    {
        KBBMainWindow *mainWin = new KBBMainWindow(args->getOption("package"), args->getOption("bug"));

        // Since all background jobs remaing running after closing the
        // main window we force a quit here
        TQObject::connect( &app, TQT_SIGNAL( lastWindowClosed() ),
                          &app, TQT_SLOT( quit() ) );
        mainWin->show();
        return app.exec();
    }
}

/* vim: set et ts=4 sw=4 softtabstop=4: */