Subversion Repositories public

Rev

Rev 194 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 andreas 1
/***************************************************************************
119 andreas 2
 *   Copyright (C) 2007, 2008 by Andreas Theofilu                          *
3
 *   andreas@theosys.at                                                    *
88 andreas 4
 *                                                                         *
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 version 3 of the License.                *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
 
132 andreas 20
#include "config.h"
88 andreas 21
#include "sportwatcher.h"
22
#include <kapplication.h>
23
#include <kaboutdata.h>
24
#include <kcmdlineargs.h>
25
#include <klocale.h>
112 andreas 26
#include <kmimesourcefactory.h>
119 andreas 27
#include <kstandarddirs.h>
88 andreas 28
 
132 andreas 29
// #include <iostream.h>
30
extern KApplication *mapp;
31
KApplication *mapp;
119 andreas 32
 
88 andreas 33
static const char description[] =
119 andreas 34
    I18N_NOOP("A KDE Application");
88 andreas 35
 
132 andreas 36
static const char version[] = VERSION;
88 andreas 37
 
38
static KCmdLineOptions options[] =
39
{
40
//    { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
41
    KCmdLineLastOption
42
};
43
 
44
int main(int argc, char **argv)
45
{
46
    KAboutData about("sportwatcher", I18N_NOOP("sportwatcher"), version, description,
119 andreas 47
                     KAboutData::License_GPL, "(C) 2007, 2008 Andreas Theofilu", 0, 0, "andreas@theosys.at");
88 andreas 48
    about.addAuthor( "Andreas Theofilu", 0, "andreas@theosys.at" );
49
    KCmdLineArgs::init(argc, argv, &about);
50
    KCmdLineArgs::addCmdLineOptions( options );
51
    KApplication app;
52
    sportwatcher *mainWin = 0;
132 andreas 53
    mapp = 0;
88 andreas 54
 
55
    if (app.isRestored())
56
    {
57
        RESTORE(sportwatcher);
58
    }
59
    else
60
    {
61
        // no session.. just start up normally
62
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
63
 
112 andreas 64
	QMimeSourceFactory* oldDefaultFactory = QMimeSourceFactory::takeDefaultFactory();
65
	QMimeSourceFactory::setDefaultFactory(app.mimeSourceFactory());
66
 
67
	if (oldDefaultFactory)
68
	   QMimeSourceFactory::addFactory(oldDefaultFactory);
69
 
119 andreas 70
	app.mimeSourceFactory()->addFilePath(KGlobal::dirs()->findResourceDir("icon", "hand.png"));
71
	QStringList icons = KGlobal::dirs()->resourceDirs("icon");
72
	QStringList::Iterator it;
73
 
74
	for (it = icons.begin(); it != icons.end(); ++it)
75
	{
76
	   app.mimeSourceFactory()->addFilePath(*it);
77
	   app.mimeSourceFactory()->addFilePath(*it);
173 andreas 78
	   app.mimeSourceFactory()->addFilePath(*it + "sportwatcher/16x16/actions/");
119 andreas 79
	   app.mimeSourceFactory()->addFilePath(*it + "hicolor/16x16/actions/");
80
	   app.mimeSourceFactory()->addFilePath(*it + "default.kde/16x16/actions/");
81
	}
82
 
83
        /// @todo do something with the command line args here
84
 
85
        mainWin = new sportwatcher();
86
        app.setMainWidget( mainWin );
88 andreas 87
        mainWin->show();
88
 
89
        args->clear();
90
    }
91
 
132 andreas 92
    mapp = &app;
88 andreas 93
    // mainWin has WDestructiveClose flag by default, so it will delete itself.
94
    return app.exec();
95
}
96