Subversion Repositories public

Rev

Go to most recent revision | Details | 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
 
20
 
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
 
119 andreas 29
#include <iostream.h>
30
 
88 andreas 31
static const char description[] =
119 andreas 32
    I18N_NOOP("A KDE Application");
88 andreas 33
 
119 andreas 34
static const char version[] = "0.2";
88 andreas 35
 
36
static KCmdLineOptions options[] =
37
{
38
//    { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
39
    KCmdLineLastOption
40
};
41
 
42
int main(int argc, char **argv)
43
{
44
    KAboutData about("sportwatcher", I18N_NOOP("sportwatcher"), version, description,
119 andreas 45
                     KAboutData::License_GPL, "(C) 2007, 2008 Andreas Theofilu", 0, 0, "andreas@theosys.at");
88 andreas 46
    about.addAuthor( "Andreas Theofilu", 0, "andreas@theosys.at" );
47
    KCmdLineArgs::init(argc, argv, &about);
48
    KCmdLineArgs::addCmdLineOptions( options );
49
    KApplication app;
50
    sportwatcher *mainWin = 0;
51
 
52
    if (app.isRestored())
53
    {
54
        RESTORE(sportwatcher);
55
    }
56
    else
57
    {
58
        // no session.. just start up normally
59
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
60
 
112 andreas 61
	QMimeSourceFactory* oldDefaultFactory = QMimeSourceFactory::takeDefaultFactory();
62
	QMimeSourceFactory::setDefaultFactory(app.mimeSourceFactory());
63
 
64
	if (oldDefaultFactory)
65
	   QMimeSourceFactory::addFactory(oldDefaultFactory);
66
 
119 andreas 67
	app.mimeSourceFactory()->addFilePath(KGlobal::dirs()->findResourceDir("icon", "hand.png"));
68
	QStringList icons = KGlobal::dirs()->resourceDirs("icon");
69
	QStringList::Iterator it;
70
 
71
	for (it = icons.begin(); it != icons.end(); ++it)
72
	{
73
	   app.mimeSourceFactory()->addFilePath(*it);
74
	   app.mimeSourceFactory()->addFilePath(*it);
75
	   app.mimeSourceFactory()->addFilePath(*it + "hicolor/16x16/actions/");
76
	   app.mimeSourceFactory()->addFilePath(*it + "default.kde/16x16/actions/");
77
	}
78
 
79
        /// @todo do something with the command line args here
80
 
81
        mainWin = new sportwatcher();
82
        app.setMainWidget( mainWin );
88 andreas 83
        mainWin->show();
84
 
85
        args->clear();
86
    }
87
 
88
    // mainWin has WDestructiveClose flag by default, so it will delete itself.
89
    return app.exec();
90
}
91