Subversion Repositories public

Rev

Rev 173 | Rev 245 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 andreas 1
/***************************************************************************
232 andreas 2
 *   Copyright (C) 2007 - 2009 by Andreas Theofilu                         *
119 andreas 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
 
232 andreas 20
/*
21
 * Ported to KDE4 on Jul. 8 2009 by Andreas Theofilu.
22
 */
132 andreas 23
#include "config.h"
232 andreas 24
#include "sportwatcherwidget.h"
88 andreas 25
#include <kapplication.h>
26
#include <kaboutdata.h>
27
#include <kcmdlineargs.h>
232 andreas 28
#include <KDE/KLocale>
29
 
30
//#include <kmimesourcefactory.h>
119 andreas 31
#include <kstandarddirs.h>
88 andreas 32
 
132 andreas 33
// #include <iostream.h>
34
extern KApplication *mapp;
35
KApplication *mapp;
119 andreas 36
 
88 andreas 37
static const char description[] =
232 andreas 38
    I18N_NOOP("A KDE 4 Application");
88 andreas 39
 
132 andreas 40
static const char version[] = VERSION;
88 andreas 41
 
232 andreas 42
int main(int argc, char **argv)
88 andreas 43
{
232 andreas 44
    KAboutData about("sportwatcher", 0, ki18n("sportwatcher"), version, ki18n(description),
45
                     KAboutData::License_GPL, ki18n("(C) 2007 - 2009 Andreas Theofilu"), KLocalizedString(), 0, "andreas@theosys.at");
46
    about.addAuthor( ki18n("Andreas Theofilu"), KLocalizedString(), "andreas@theosys.at" );
88 andreas 47
 
48
    KCmdLineArgs::init(argc, argv, &about);
232 andreas 49
    KCmdLineOptions options;
50
    options.add ("+[URL]", ki18n ("Document to open"));
51
    KCmdLineArgs::addCmdLineOptions (options);
88 andreas 52
    KApplication app;
232 andreas 53
    sportwatcherWidget *mainWin = new sportwatcherWidget;
132 andreas 54
    mapp = 0;
88 andreas 55
 
232 andreas 56
    if (app.isSessionRestored())
88 andreas 57
    {
232 andreas 58
        RESTORE(sportwatcherWidget);
88 andreas 59
    }
60
    else
61
    {
62
        // no session.. just start up normally
63
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
64
 
232 andreas 65
	if (args->count () == 0)
66
	   mainWin->show();
67
	else
68
	{
69
	   int i = 0;
70
 
71
	   for (; i < args->count(); i++)
72
	      mainWin->show();
73
	}
74
 
75
	args->clear();
76
 
77
/*	QMimeSourceFactory* oldDefaultFactory = QMimeSourceFactory::takeDefaultFactory();
112 andreas 78
	QMimeSourceFactory::setDefaultFactory(app.mimeSourceFactory());
79
 
80
	if (oldDefaultFactory)
81
	   QMimeSourceFactory::addFactory(oldDefaultFactory);
82
 
119 andreas 83
	app.mimeSourceFactory()->addFilePath(KGlobal::dirs()->findResourceDir("icon", "hand.png"));
84
	QStringList icons = KGlobal::dirs()->resourceDirs("icon");
85
	QStringList::Iterator it;
86
 
87
	for (it = icons.begin(); it != icons.end(); ++it)
88
	{
89
	   app.mimeSourceFactory()->addFilePath(*it);
90
	   app.mimeSourceFactory()->addFilePath(*it);
173 andreas 91
	   app.mimeSourceFactory()->addFilePath(*it + "sportwatcher/16x16/actions/");
119 andreas 92
	   app.mimeSourceFactory()->addFilePath(*it + "hicolor/16x16/actions/");
93
	   app.mimeSourceFactory()->addFilePath(*it + "default.kde/16x16/actions/");
232 andreas 94
	} */
88 andreas 95
    }
96
 
132 andreas 97
    mapp = &app;
88 andreas 98
    // mainWin has WDestructiveClose flag by default, so it will delete itself.
99
    return app.exec();
100
}
101