mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-27 10:00:38 -05:00
Merge branch 'master'
Conflicts: INSTALL.md release-tool src/browser/BrowserOptionDialog.cpp src/browser/BrowserService.cpp src/browser/BrowserService.h src/browser/NativeMessagingBase.h src/browser/NativeMessagingHost.h src/core/Uuid.cpp src/gui/DatabaseTabWidget.cpp src/gui/DatabaseWidget.cpp src/gui/EditWidget.cpp src/gui/MainWindow.cpp src/gui/MainWindow.ui src/proxy/NativeMessagingHost.h src/sshagent/ASN1Key.cpp
This commit is contained in:
commit
ca27fb06d5
52 changed files with 5657 additions and 1106 deletions
|
|
@ -53,6 +53,21 @@ NativeMessagingHost::~NativeMessagingHost()
|
|||
#endif
|
||||
}
|
||||
|
||||
void NativeMessagingHost::readNativeMessages()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
quint32 length = 0;
|
||||
while (m_running.load() && !std::cin.eof()) {
|
||||
length = 0;
|
||||
std::cin.read(reinterpret_cast<char*>(&length), 4);
|
||||
if (!readStdIn(length)) {
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
QThread::msleep(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void NativeMessagingHost::readLength()
|
||||
{
|
||||
quint32 length = 0;
|
||||
|
|
@ -64,10 +79,10 @@ void NativeMessagingHost::readLength()
|
|||
}
|
||||
}
|
||||
|
||||
void NativeMessagingHost::readStdIn(const quint32 length)
|
||||
bool NativeMessagingHost::readStdIn(const quint32 length)
|
||||
{
|
||||
if (length <= 0) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray arr;
|
||||
|
|
@ -77,7 +92,7 @@ void NativeMessagingHost::readStdIn(const quint32 length)
|
|||
int c = std::getchar();
|
||||
if (c == EOF) {
|
||||
// message ended prematurely, ignore it and return
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
arr.append(static_cast<char>(c));
|
||||
}
|
||||
|
|
@ -86,6 +101,8 @@ void NativeMessagingHost::readStdIn(const quint32 length)
|
|||
m_localSocket->write(arr.constData(), arr.length());
|
||||
m_localSocket->flush();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NativeMessagingHost::newLocalMessage()
|
||||
|
|
|
|||
|
|
@ -33,8 +33,9 @@ public slots:
|
|||
void socketStateChanged(QLocalSocket::LocalSocketState socketState);
|
||||
|
||||
private:
|
||||
void readNativeMessages();
|
||||
void readLength();
|
||||
void readStdIn(const quint32 length);
|
||||
bool readStdIn(const quint32 length);
|
||||
|
||||
private:
|
||||
QLocalSocket* m_localSocket;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue