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