Subversion Repositories public

Rev

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

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