Fix daemon's error handling
This commit is contained in:
parent
a787b692f6
commit
2b7026fc10
3 changed files with 13 additions and 4 deletions
|
@ -54,6 +54,7 @@ struct DaemonPrivate
|
|||
QMap<QString, Device*> m_devices;
|
||||
|
||||
QSet<QString> m_discoveryModeAcquisitions;
|
||||
bool m_testMode;
|
||||
};
|
||||
|
||||
Daemon* Daemon::instance()
|
||||
|
@ -68,10 +69,18 @@ Daemon::Daemon(QObject* parent, bool testMode)
|
|||
{
|
||||
Q_ASSERT(!s_instance);
|
||||
s_instance = this;
|
||||
d->m_testMode = testMode;
|
||||
|
||||
// HACK init may call pure virtual functions from this class so it can't be called directly from the ctor
|
||||
QTimer::singleShot(0, this, &Daemon::init);
|
||||
}
|
||||
|
||||
void Daemon::init()
|
||||
{
|
||||
qCDebug(KDECONNECT_CORE) << "KdeConnect daemon starting";
|
||||
|
||||
//Load backends
|
||||
if (testMode)
|
||||
if (d->m_testMode)
|
||||
d->m_linkProviders.insert(new LoopbackLinkProvider());
|
||||
else {
|
||||
d->m_linkProviders.insert(new LanLinkProvider());
|
||||
|
|
|
@ -90,6 +90,9 @@ private Q_SLOTS:
|
|||
void onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl);
|
||||
void onDeviceStatusChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
protected:
|
||||
void addDevice(Device* device);
|
||||
bool isDiscoveringDevices() const;
|
||||
|
|
|
@ -71,7 +71,6 @@ KdeConnectConfig::KdeConnectConfig()
|
|||
i18n("Could not find support for RSA in your QCA installation. If your "
|
||||
"distribution provides separate packets for QCA-ossl and QCA-gnupg, "
|
||||
"make sure you have them installed and try again."));
|
||||
Daemon::instance()->quit();
|
||||
}
|
||||
|
||||
//Make sure base directory exists
|
||||
|
@ -281,7 +280,6 @@ void KdeConnectConfig::generatePrivateKey(const QString& keyPath)
|
|||
|
||||
if (error) {
|
||||
Daemon::instance()->reportError(QStringLiteral("KDE Connect"), i18n("Could not store private key file: %1", keyPath));
|
||||
Daemon::instance()->quit();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -327,6 +325,5 @@ void KdeConnectConfig::generateCertificate(const QString& certPath)
|
|||
|
||||
if (error) {
|
||||
Daemon::instance()->reportError(QStringLiteral("KDE Connect"), i18n("Could not store certificate file: %1", certPath));
|
||||
Daemon::instance()->quit();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue