kioclent: replace QApplication with KApplication

for the signal handler mostly, tho other things such KGlobalSettings
activatation and listening for changes also comes into mind

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-01 06:35:01 +03:00
parent 6b784856d1
commit d10a43fa12
2 changed files with 6 additions and 24 deletions

View file

@ -151,7 +151,7 @@ void ClientApp::delayedQuit()
{
// Quit in 2 seconds. This leaves time for KRun to pop up
// "app not found" in KProcessRunner, if that was the case.
QTimer::singleShot( 2000, this, SLOT(deref()) );
QTimer::singleShot( 2000, this, SLOT(quit()) );
// don't access the KRun instance later, it will be deleted after calling slots
if( static_cast< const KRun* >( sender())->hasError())
krun_has_error = true;
@ -277,13 +277,9 @@ bool ClientApp::doIt()
#endif
kDebug() << "Creating ClientApp";
int fake_argc = 0;
char** fake_argv = 0;
ClientApp app( fake_argc, fake_argv );
ClientApp app;
KComponentData componentData("kioclient"); // needed by KIO's internal use of KConfig
app.setApplicationName(componentData.componentName());
KGlobal::ref();
KGlobal::setAllowQuit(true);
// KIO needs dbus (for uiserver communication)
if (!QDBusConnection::sessionBus().isConnected())
@ -406,20 +402,10 @@ void ClientApp::slotDialogCanceled()
quit();
}
void ClientApp::deref()
{
KGlobal::deref();
}
void ClientApp::slotPrintData(KIO::Job*, const QByteArray &data)
{
if (!data.isEmpty())
std::cout.write(data.constData(), data.size());
}
ClientApp::ClientApp(int &argc, char **argv )
: QApplication( argc, argv )
{
}
#include "moc_kioclient.cpp"

View file

@ -19,18 +19,15 @@
#ifndef KIOCLIENT_H
#define KIOCLIENT_H
#include <QApplication>
#include <kapplication.h>
#include <kurl.h>
#include <kio/udsentry.h>
class KUrl;
class KJob;
namespace KIO { class Job; }
#include <kio/job.h>
class ClientApp : public QApplication
class ClientApp : public KApplication
{
Q_OBJECT
public:
ClientApp(int &argc, char **argv );
/** Parse command-line arguments and "do it" */
static bool doIt();
@ -40,7 +37,6 @@ private Q_SLOTS:
void slotResult( KJob * );
void delayedQuit();
void slotDialogCanceled();
void deref();
private:
bool kde_open( const KUrl& url, const QString& mimeType, bool allowExec );