1 /* This file is part of the KDE project
3 Copyright (C) 2002 by Patrick Charbonnier <pch@freeshell.org>
4 Based On Caitoo v.0.7.3 (c) 1998 - 2000, Matej Koss
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
14 #include <kwindowsystem.h>
16 #include <kaboutdata.h>
17 #include <kcmdlineargs.h>
18 #include <kuniqueapplication.h>
19 #include <kstandarddirs.h>
21 #include "core/kget.h"
22 #include "kgetadaptor.h"
24 #include "ui/splash.h"
25 #include "mainwindow.h"
27 class KGetApp
: public KUniqueApplication
31 : KUniqueApplication(), kget( 0 ), splash( 0 )
44 //determine whether splash-screen is enabled in kgetrc
45 if ( !Settings::showSplashscreen() )
48 // getting splash-screen path
49 QString path
= KStandardDirs::locate( "data", "kget/pics/kget_splash.png" );
51 if ( !path
.isEmpty() )
52 splash
= new Splash( path
);
57 KCmdLineArgs
*args
= KCmdLineArgs::parsedArgs();
61 kget
= new MainWindow(!args
->isSet("showDropTarget"), args
->isSet("startWithoutAnimation"));
62 new KgetAdaptor(kget
);
63 QDBusConnection::sessionBus().registerObject("/KGet", kget
);
65 KWindowSystem::activateWindow(kget
->winId());
67 if (args
->isSet("showDropTarget"))
68 Settings::setShowDropTarget( true );
71 for (int i
= 0; i
< args
->count(); i
++)
73 QString
txt(args
->arg(i
));
74 if ( txt
.endsWith( ".kgt", Qt::CaseInsensitive
) )
77 l
.push_back(KUrl(args
->arg(i
)));
79 // all the args read from command line are downloads
81 KGet::addTransfer(l
, QString(), QString(), true);
83 // the last arg read (when we have more than 1 arg) is considered
84 // as destination dir for the previous downloads
86 kget->addTransfersEx( l, KUrl());
87 else if (l.count() > 1)
91 kget->addTransfersEx(l, last);
96 splash
->removeSplash();
106 int main(int argc
, char *argv
[])
108 KAboutData
aboutData("kget", 0, ki18n("KGet"), "2.0 Beta1",
109 ki18n("An advanced download manager for KDE"),
110 KAboutData::License_GPL
,
111 ki18n("(C) 2005 - 2007, The KGet developers\n"
112 "(C) 2001 - 2002, Patrick Charbonnier\n"
113 "(C) 2002, Carsten Pfeiffer\n"
114 "(C) 1998 - 2000, Matej Koss"),
115 ki18n("<a href=\"mailto:kget@kde.org\">kget@kde.org</a>"));
117 aboutData
.addAuthor(ki18n("Dario Massarin"), ki18n("Maintainer, Core Developer"), "nekkar@libero.it");
118 aboutData
.addAuthor(ki18n("Urs Wolfer"), ki18n("Core Developer"), "uwolfer@kde.org");
119 aboutData
.addAuthor(ki18n("Manolo Valdes"), ki18n("Core Developer, Multithreaded Plugin Author"), "nolis71cu@gmail.com");
120 aboutData
.addAuthor(ki18n("Javier Goday"), ki18n("Developer"), "jgoday@gmail.com");
121 aboutData
.addAuthor(ki18n("Patrick Charbonnier"), ki18n("Former Developer"), "pch@freeshell.org");
122 aboutData
.addAuthor(ki18n("Carsten Pfeiffer"), ki18n("Former Developer"), "pfeiffer@kde.org");
123 aboutData
.addAuthor(ki18n("Matej Koss"), ki18n("Former Developer"));
125 KCmdLineArgs::init(argc
, argv
, &aboutData
);
127 KCmdLineOptions option
;
128 option
.add("showDropTarget", ki18n("Start KGet with drop target"));
129 option
.add("hideMainWindow", ki18n("Start KGet with hidden main window"));
130 option
.add("startWithoutAnimation", ki18n("Start KGet without drop target animation"));
131 option
.add("+[URL(s)]", ki18n("URL(s) to download"));
132 KCmdLineArgs::addCmdLineOptions(option
);
134 KGetApp::addCmdLineOptions();
136 if (!KGetApp::start())
138 fprintf(stderr
, "kget is already running!\n");