Subversion Repositories public

Rev

Rev 173 | Rev 245 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 173 Rev 232
Line 1... Line 1...
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2007, 2008 by Andreas Theofilu                          *
2
 *   Copyright (C) 2007 - 2009 by Andreas Theofilu                         *
3
 *   andreas@theosys.at                                                    *
3
 *   andreas@theosys.at                                                    *
4
 *                                                                         *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
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  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation version 3 of the License.                *
7
 *   the Free Software Foundation version 3 of the License.                *
Line 15... Line 15...
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
 
19
 
-
 
20
/*
-
 
21
 * Ported to KDE4 on Jul. 8 2009 by Andreas Theofilu.
-
 
22
 */
20
#include "config.h"
23
#include "config.h"
21
#include "sportwatcher.h"
24
#include "sportwatcherwidget.h"
22
#include <kapplication.h>
25
#include <kapplication.h>
23
#include <kaboutdata.h>
26
#include <kaboutdata.h>
24
#include <kcmdlineargs.h>
27
#include <kcmdlineargs.h>
25
#include <klocale.h>
28
#include <KDE/KLocale>
-
 
29
 
26
#include <kmimesourcefactory.h>
30
//#include <kmimesourcefactory.h>
27
#include <kstandarddirs.h>
31
#include <kstandarddirs.h>
28
 
32
 
29
// #include <iostream.h>
33
// #include <iostream.h>
30
extern KApplication *mapp;
34
extern KApplication *mapp;
31
KApplication *mapp;
35
KApplication *mapp;
32
 
36
 
33
static const char description[] =
37
static const char description[] =
34
    I18N_NOOP("A KDE Application");
38
    I18N_NOOP("A KDE 4 Application");
35
 
39
 
36
static const char version[] = VERSION;
40
static const char version[] = VERSION;
37
 
41
 
38
static KCmdLineOptions options[] =
-
 
39
{
-
 
40
//    { "+[URL]", I18N_NOOP( "Document to open" ), 0 },
-
 
41
    KCmdLineLastOption
-
 
42
};
-
 
43
 
-
 
44
int main(int argc, char **argv)
42
int main(int argc, char **argv)
45
{
43
{
46
    KAboutData about("sportwatcher", I18N_NOOP("sportwatcher"), version, description,
44
    KAboutData about("sportwatcher", 0, ki18n("sportwatcher"), version, ki18n(description),
47
                     KAboutData::License_GPL, "(C) 2007, 2008 Andreas Theofilu", 0, 0, "andreas@theosys.at");
45
                     KAboutData::License_GPL, ki18n("(C) 2007 - 2009 Andreas Theofilu"), KLocalizedString(), 0, "andreas@theosys.at");
48
    about.addAuthor( "Andreas Theofilu", 0, "andreas@theosys.at" );
46
    about.addAuthor( ki18n("Andreas Theofilu"), KLocalizedString(), "andreas@theosys.at" );
-
 
47
 
49
    KCmdLineArgs::init(argc, argv, &about);
48
    KCmdLineArgs::init(argc, argv, &about);
-
 
49
    KCmdLineOptions options;
-
 
50
    options.add ("+[URL]", ki18n ("Document to open"));
50
    KCmdLineArgs::addCmdLineOptions( options );
51
    KCmdLineArgs::addCmdLineOptions (options);
51
    KApplication app;
52
    KApplication app;
52
    sportwatcher *mainWin = 0;
53
    sportwatcherWidget *mainWin = new sportwatcherWidget;
53
    mapp = 0;
54
    mapp = 0;
54
 
55
 
55
    if (app.isRestored())
56
    if (app.isSessionRestored())
56
    {
57
    {
57
        RESTORE(sportwatcher);
58
        RESTORE(sportwatcherWidget);
58
    }
59
    }
59
    else
60
    else
60
    {
61
    {
61
        // no session.. just start up normally
62
        // no session.. just start up normally
62
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
63
        KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
63
 
64
 
-
 
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
 
64
	QMimeSourceFactory* oldDefaultFactory = QMimeSourceFactory::takeDefaultFactory();
77
/*	QMimeSourceFactory* oldDefaultFactory = QMimeSourceFactory::takeDefaultFactory();
65
	QMimeSourceFactory::setDefaultFactory(app.mimeSourceFactory());
78
	QMimeSourceFactory::setDefaultFactory(app.mimeSourceFactory());
66
 
79
 
67
	if (oldDefaultFactory)
80
	if (oldDefaultFactory)
68
	   QMimeSourceFactory::addFactory(oldDefaultFactory);
81
	   QMimeSourceFactory::addFactory(oldDefaultFactory);
69
 
82
 
Line 76... Line 89...
76
	   app.mimeSourceFactory()->addFilePath(*it);
89
	   app.mimeSourceFactory()->addFilePath(*it);
77
	   app.mimeSourceFactory()->addFilePath(*it);
90
	   app.mimeSourceFactory()->addFilePath(*it);
78
	   app.mimeSourceFactory()->addFilePath(*it + "sportwatcher/16x16/actions/");
91
	   app.mimeSourceFactory()->addFilePath(*it + "sportwatcher/16x16/actions/");
79
	   app.mimeSourceFactory()->addFilePath(*it + "hicolor/16x16/actions/");
92
	   app.mimeSourceFactory()->addFilePath(*it + "hicolor/16x16/actions/");
80
	   app.mimeSourceFactory()->addFilePath(*it + "default.kde/16x16/actions/");
93
	   app.mimeSourceFactory()->addFilePath(*it + "default.kde/16x16/actions/");
81
	}
94
	} */
82
 
-
 
83
        /// @todo do something with the command line args here
-
 
84
 
-
 
85
        mainWin = new sportwatcher();
-
 
86
        app.setMainWidget( mainWin );
-
 
87
        mainWin->show();
-
 
88
 
-
 
89
        args->clear();
-
 
90
    }
95
    }
91
 
96
 
92
    mapp = &app;
97
    mapp = &app;
93
    // mainWin has WDestructiveClose flag by default, so it will delete itself.
98
    // mainWin has WDestructiveClose flag by default, so it will delete itself.
94
    return app.exec();
99
    return app.exec();