|
|
|
@ -37,7 +37,7 @@
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include "kmainwidget.h"
|
|
|
|
|
#include "tdemainwidget.h"
|
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -64,9 +64,9 @@ static void signalHandler(int sigId)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "*** KGet got signal %d\n", sigId);
|
|
|
|
|
|
|
|
|
|
if (sigId != SIGSEGV && kmain) {
|
|
|
|
|
if (sigId != SIGSEGV && tdemain) {
|
|
|
|
|
fprintf(stderr, "*** KGet saving data\n");
|
|
|
|
|
delete kmain;
|
|
|
|
|
delete tdemain;
|
|
|
|
|
}
|
|
|
|
|
// If Kget crashes again below this line we consider the data lost :-|
|
|
|
|
|
// Otherwise Kget will end in an infinite loop.
|
|
|
|
@ -101,7 +101,7 @@ static void cleanup(void)
|
|
|
|
|
class KGetApp : public KUniqueApplication
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
TDEMainWidget *kmainwidget;
|
|
|
|
|
TDEMainWidget *tdemainwidget;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
KGetApp() : KUniqueApplication()
|
|
|
|
@ -110,7 +110,7 @@ public:
|
|
|
|
|
sDebugIn << endl;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
kmainwidget=0;
|
|
|
|
|
tdemainwidget=0;
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
sDebugOut << endl;
|
|
|
|
@ -122,7 +122,7 @@ public:
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
sDebugIn << endl;
|
|
|
|
|
#endif
|
|
|
|
|
delete kmainwidget;
|
|
|
|
|
delete tdemainwidget;
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
sDebugOut << endl;
|
|
|
|
|
#endif
|
|
|
|
@ -132,26 +132,26 @@ public:
|
|
|
|
|
int newInstance()
|
|
|
|
|
{
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
sDebugIn <<"kmainwidget="<<kmainwidget << endl;
|
|
|
|
|
sDebugIn <<"tdemainwidget="<<tdemainwidget << endl;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (kmainwidget==0)
|
|
|
|
|
if (tdemainwidget==0)
|
|
|
|
|
{
|
|
|
|
|
if(args->count()>0)
|
|
|
|
|
kmainwidget=new TDEMainWidget(true);
|
|
|
|
|
tdemainwidget=new TDEMainWidget(true);
|
|
|
|
|
else
|
|
|
|
|
kmainwidget=new TDEMainWidget();
|
|
|
|
|
setMainWidget(kmain);
|
|
|
|
|
tdemainwidget=new TDEMainWidget();
|
|
|
|
|
setMainWidget(tdemain);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
TDEStartupInfo::setNewStartupId( mainWidget(), kapp->startupId());
|
|
|
|
|
|
|
|
|
|
if (args->isSet("showDropTarget"))
|
|
|
|
|
kmain->activateDropTarget();
|
|
|
|
|
tdemain->activateDropTarget();
|
|
|
|
|
|
|
|
|
|
if (args->count()==1)
|
|
|
|
|
{
|
|
|
|
@ -160,9 +160,9 @@ public:
|
|
|
|
|
#endif
|
|
|
|
|
TQString txt(args->arg(0));
|
|
|
|
|
if ( txt.endsWith( ".kgt" ) )
|
|
|
|
|
kmain->readTransfersEx(KURL::fromPathOrURL( txt ));
|
|
|
|
|
tdemain->readTransfersEx(KURL::fromPathOrURL( txt ));
|
|
|
|
|
else
|
|
|
|
|
kmain->addTransferEx( KURL::fromPathOrURL( txt ),
|
|
|
|
|
tdemain->addTransferEx( KURL::fromPathOrURL( txt ),
|
|
|
|
|
KURL());
|
|
|
|
|
}
|
|
|
|
|
else if(args->count()>=2)
|
|
|
|
@ -175,11 +175,11 @@ public:
|
|
|
|
|
// Sometimes valid filenames are not recognised by KURL::isLocalFile(), they are marked as invalid then
|
|
|
|
|
if ( args->count()==2 && ( urls.last().isLocalFile() || !urls.last().isValid()))
|
|
|
|
|
{
|
|
|
|
|
kmain->addTransferEx( urls.first(), urls.last() );
|
|
|
|
|
tdemain->addTransferEx( urls.first(), urls.last() );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kmain->addTransfers( urls, TQString() );
|
|
|
|
|
tdemain->addTransfers( urls, TQString() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
args->clear();
|
|
|
|
|