mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
qtkeychain: update to 0.10.0
Still some patches to apply
This commit is contained in:
@@ -1,17 +1,95 @@
|
||||
From a0fa0df39e775dcdae816ac9c5e1d36f6077ac35 Mon Sep 17 00:00:00 2001
|
||||
From cbc626edcd4920704f74d271acc1fd6dac508b2e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Sat, 17 Nov 2018 18:38:47 +0100
|
||||
Subject: [PATCH 1/2] Add Haiku support
|
||||
Date: Tue, 20 Nov 2018 21:16:37 +0100
|
||||
Subject: [PATCH 1/2] build: KEYCHAIN_DBUS
|
||||
|
||||
---
|
||||
CMakeLists.txt | 17 ++++--
|
||||
keychain_haiku.cpp | 129 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
keychain_p.h | 10 ++--
|
||||
3 files changed, 148 insertions(+), 8 deletions(-)
|
||||
CMakeLists.txt | 1 +
|
||||
keychain_p.h | 10 +++++-----
|
||||
2 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8e5320e..185fa68 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -160,6 +160,7 @@ if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
list(APPEND qtkeychain_LIBRARIES ${LIBSECRET_LIBRARIES})
|
||||
endif()
|
||||
|
||||
+ add_definitions(-DKEYCHAIN_DBUS=1)
|
||||
list(APPEND qtkeychain_SOURCES keychain_unix.cpp gnomekeyring.cpp libsecret.cpp plaintextstore.cpp)
|
||||
qt_add_dbus_interface(qtkeychain_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.KWallet.xml kwallet_interface KWalletInterface)
|
||||
list(APPEND qtkeychain_LIBRARIES ${QTDBUS_LIBRARIES} )
|
||||
diff --git a/keychain_p.h b/keychain_p.h
|
||||
index ab7f0be..58c0fd6 100644
|
||||
--- a/keychain_p.h
|
||||
+++ b/keychain_p.h
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <QSettings>
|
||||
#include <QQueue>
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(KEYCHAIN_DBUS)
|
||||
|
||||
#include <QDBusPendingCallWatcher>
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
Mode mode;
|
||||
QByteArray data;
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(KEYCHAIN_DBUS)
|
||||
org::kde::KWallet* iface;
|
||||
int walletHandle;
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
explicit ReadPasswordJobPrivate( const QString &service_, ReadPasswordJob* qq );
|
||||
void scheduledStart();
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(KEYCHAIN_DBUS)
|
||||
void fallbackOnError(const QDBusError& err);
|
||||
|
||||
private Q_SLOTS:
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
explicit WritePasswordJobPrivate( const QString &service_, WritePasswordJob* qq );
|
||||
void scheduledStart();
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(KEYCHAIN_DBUS)
|
||||
void fallbackOnError(const QDBusError& err);
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
|
||||
void scheduledStart();
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(KEYCHAIN_DBUS)
|
||||
void fallbackOnError(const QDBusError& err);
|
||||
#endif
|
||||
|
||||
--
|
||||
2.24.1
|
||||
|
||||
|
||||
From 2f535170e6792dfc48606ebc9d3b6753984f5fca Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Sat, 17 Nov 2018 18:38:47 +0100
|
||||
Subject: [PATCH 2/2] Add Haiku support
|
||||
|
||||
We had to work around QCoreApplication not creating a BApplication:
|
||||
When not used in a GUI application, we must create a BApplication object
|
||||
ourselves as it's required for the API we use.
|
||||
At least until QCoreApplication is fixed to create one maybe.
|
||||
---
|
||||
CMakeLists.txt | 17 ++++-
|
||||
keychain_haiku.cpp | 187 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 201 insertions(+), 3 deletions(-)
|
||||
create mode 100644 keychain_haiku.cpp
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4449bc2..2e7dccf 100644
|
||||
index 185fa68..db7273d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -26,6 +26,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL Android)
|
||||
@@ -50,7 +128,7 @@ index 4449bc2..2e7dccf 100644
|
||||
option(LIBSECRET_SUPPORT "Build with libsecret support" ON)
|
||||
|
||||
if(LIBSECRET_SUPPORT)
|
||||
@@ -248,7 +259,7 @@ ecm_setup_version("${QTKEYCHAIN_VERSION}" VARIABLE_PREFIX SNORE
|
||||
@@ -252,7 +263,7 @@ ecm_setup_version("${QTKEYCHAIN_VERSION}" VARIABLE_PREFIX SNORE
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Qt${QTKEYCHAIN_VERSION_INFIX}KeychainConfigVersion.cmake"
|
||||
SOVERSION ${QTKEYCHAIN_VERSION})
|
||||
|
||||
@@ -61,12 +139,12 @@ index 4449bc2..2e7dccf 100644
|
||||
ecm_generate_pri_file(BASE_NAME Qt${QTKEYCHAIN_VERSION_INFIX}Keychain
|
||||
diff --git a/keychain_haiku.cpp b/keychain_haiku.cpp
|
||||
new file mode 100644
|
||||
index 0000000..f54d2c8
|
||||
index 0000000..58b1ab7
|
||||
--- /dev/null
|
||||
+++ b/keychain_haiku.cpp
|
||||
@@ -0,0 +1,129 @@
|
||||
@@ -0,0 +1,187 @@
|
||||
+/******************************************************************************
|
||||
+ * Copyright (C) 2011-2015 Frank Osterfeld <frank.osterfeld@gmail.com> *
|
||||
+ * Copyright (C) 2018 François Revol <revol@free.fr> *
|
||||
+ * *
|
||||
+ * This program is distributed in the hope that it will be useful, but *
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
|
||||
@@ -76,10 +154,64 @@ index 0000000..f54d2c8
|
||||
+#include "keychain_p.h"
|
||||
+
|
||||
+#include <KeyStore.h>
|
||||
+
|
||||
+#include <Application.h>
|
||||
+#include <AppFileInfo.h>
|
||||
+#include <File.h>
|
||||
+
|
||||
+#include <QDebug>
|
||||
+#include <QCoreApplication>
|
||||
+#include <QString>
|
||||
+
|
||||
+using namespace QKeychain;
|
||||
+
|
||||
+class AutoApp {
|
||||
+public:
|
||||
+ AutoApp();
|
||||
+ ~AutoApp();
|
||||
+ BApplication *app;
|
||||
+};
|
||||
+
|
||||
+
|
||||
+AutoApp::AutoApp()
|
||||
+ : app(NULL)
|
||||
+{
|
||||
+ if (be_app != NULL)
|
||||
+ return;
|
||||
+
|
||||
+ // no BApplication object, probably using QCoreApplication
|
||||
+ // but we need one around
|
||||
+
|
||||
+ QString appSignature;
|
||||
+
|
||||
+ char signature[B_MIME_TYPE_LENGTH];
|
||||
+ signature[0] = '\0';
|
||||
+
|
||||
+ QString appPath = QCoreApplication::applicationFilePath();
|
||||
+
|
||||
+ BFile appFile(appPath.toUtf8(), B_READ_ONLY);
|
||||
+ if (appFile.InitCheck() == B_OK) {
|
||||
+ BAppFileInfo info(&appFile);
|
||||
+ if (info.InitCheck() == B_OK) {
|
||||
+ if (info.GetSignature(signature) != B_OK)
|
||||
+ signature[0] = '\0';
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (signature[0] != '\0')
|
||||
+ appSignature = QLatin1String(signature);
|
||||
+ else
|
||||
+ appSignature = QLatin1String("application/x-vnd.qtkeychain-") +
|
||||
+ QCoreApplication::applicationName().remove("_x86");
|
||||
+
|
||||
+ app = new BApplication(appSignature.toUtf8().constData());
|
||||
+}
|
||||
+
|
||||
+AutoApp::~AutoApp()
|
||||
+{
|
||||
+ delete app;
|
||||
+}
|
||||
+
|
||||
+static QString strForStatus( status_t os ) {
|
||||
+ const char * const buf = strerror(os) ;
|
||||
+ return QObject::tr( "error 0x%1: %2" )
|
||||
@@ -88,6 +220,7 @@ index 0000000..f54d2c8
|
||||
+
|
||||
+void ReadPasswordJobPrivate::scheduledStart()
|
||||
+{
|
||||
+ AutoApp aa;
|
||||
+ QString errorString;
|
||||
+ Error error = NoError;
|
||||
+ BKeyStore keyStore;
|
||||
@@ -98,7 +231,7 @@ index 0000000..f54d2c8
|
||||
+ q->key().toUtf8().constData(),
|
||||
+ false, password);
|
||||
+
|
||||
+ data = QByteArray((char*)password.Data(), password.DataLength());
|
||||
+ data = QByteArray(reinterpret_cast<const char*>(password.Data()), password.DataLength());
|
||||
+
|
||||
+ switch ( result ) {
|
||||
+ case B_OK:
|
||||
@@ -119,6 +252,7 @@ index 0000000..f54d2c8
|
||||
+
|
||||
+void WritePasswordJobPrivate::scheduledStart()
|
||||
+{
|
||||
+ AutoApp aa;
|
||||
+ QString errorString;
|
||||
+ Error error = NoError;
|
||||
+ BKeyStore keyStore;
|
||||
@@ -126,10 +260,11 @@ index 0000000..f54d2c8
|
||||
+ B_KEY_PURPOSE_GENERIC,
|
||||
+ q->service().toUtf8().constData(),
|
||||
+ q->key().toUtf8().constData());
|
||||
+ status_t result;
|
||||
+ status_t result = B_OK;
|
||||
+
|
||||
+ // XXX: is it a string or a blob??
|
||||
+ result = password.SetData(reinterpret_cast<const uint8*>(data.constData()), data.size());
|
||||
+ // re-add as binary if it's not text
|
||||
+ if (mode == Binary)
|
||||
+ result = password.SetData(reinterpret_cast<const uint8*>(data.constData()), data.size());
|
||||
+
|
||||
+ if (result == B_OK)
|
||||
+ result = keyStore.AddKey(password);
|
||||
@@ -165,6 +300,7 @@ index 0000000..f54d2c8
|
||||
+
|
||||
+void DeletePasswordJobPrivate::scheduledStart()
|
||||
+{
|
||||
+ AutoApp aa;
|
||||
+ QString errorString;
|
||||
+ Error error = NoError;
|
||||
+ BKeyStore keyStore;
|
||||
@@ -194,94 +330,33 @@ index 0000000..f54d2c8
|
||||
+
|
||||
+ q->emitFinishedWithError( error, errorString );
|
||||
+}
|
||||
diff --git a/keychain_p.h b/keychain_p.h
|
||||
index ab7f0be..f91db7c 100644
|
||||
--- a/keychain_p.h
|
||||
+++ b/keychain_p.h
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <QSettings>
|
||||
#include <QQueue>
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
|
||||
|
||||
#include <QDBusPendingCallWatcher>
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
Mode mode;
|
||||
QByteArray data;
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
|
||||
org::kde::KWallet* iface;
|
||||
int walletHandle;
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
explicit ReadPasswordJobPrivate( const QString &service_, ReadPasswordJob* qq );
|
||||
void scheduledStart();
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
|
||||
void fallbackOnError(const QDBusError& err);
|
||||
|
||||
private Q_SLOTS:
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
explicit WritePasswordJobPrivate( const QString &service_, WritePasswordJob* qq );
|
||||
void scheduledStart();
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
|
||||
void fallbackOnError(const QDBusError& err);
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
|
||||
void scheduledStart();
|
||||
|
||||
-#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
|
||||
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU)
|
||||
void fallbackOnError(const QDBusError& err);
|
||||
#endif
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
|
||||
From 3bfc854a3595618096c4a55270ac46c318646f9f Mon Sep 17 00:00:00 2001
|
||||
2.24.1
|
||||
From 59de297f69ff03275ed07dab6883293315ace3d2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Sat, 17 Nov 2018 18:39:27 +0100
|
||||
Subject: [PATCH 2/2] HACK: Haiku: work around QCoreApplication not creating a
|
||||
BApplication
|
||||
Date: Tue, 4 Feb 2020 00:13:38 +0100
|
||||
Subject: [PATCH] Allow overriding install include path for Haiku
|
||||
|
||||
---
|
||||
testclient.cpp | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
CMakeLists.txt | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/testclient.cpp b/testclient.cpp
|
||||
index 94189cf..b34a32f 100644
|
||||
--- a/testclient.cpp
|
||||
+++ b/testclient.cpp
|
||||
@@ -8,6 +8,9 @@
|
||||
*****************************************************************************/
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
+#ifdef __HAIKU__
|
||||
+#include <Application.h>
|
||||
+#endif
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ce7fec4..ab0ec68 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -215,7 +215,10 @@ else()
|
||||
endif()
|
||||
|
||||
#include "keychain.h"
|
||||
#include <iostream>
|
||||
@@ -23,6 +26,10 @@ static int printUsage() {
|
||||
target_link_libraries(${QTKEYCHAIN_TARGET_NAME} PUBLIC ${qtkeychain_LIBRARIES})
|
||||
-target_include_directories(${QTKEYCHAIN_TARGET_NAME} PUBLIC $<INSTALL_INTERFACE:include/>)
|
||||
+if(NOT INTERFACE_INCLUDE_SUFFIX)
|
||||
+ set(INTERFACE_INCLUDE_SUFFIX include)
|
||||
+endif()
|
||||
+target_include_directories(${QTKEYCHAIN_TARGET_NAME} PUBLIC $<INSTALL_INTERFACE:${INTERFACE_INCLUDE_SUFFIX}/>)
|
||||
|
||||
int main( int argc, char** argv ) {
|
||||
QCoreApplication app( argc, argv );
|
||||
+#ifdef __HAIKU__
|
||||
+ // XXX: for some reason the QApp object doesn't create a BApp
|
||||
+ BApplication bapp("application/x-vnd.QtKeychain");
|
||||
+#endif
|
||||
const QStringList args = app.arguments();
|
||||
if ( args.count() < 2 )
|
||||
return printUsage();
|
||||
generate_export_header(${QTKEYCHAIN_TARGET_NAME}
|
||||
EXPORT_FILE_NAME qkeychain_export.h
|
||||
--
|
||||
2.19.1
|
||||
2.24.1
|
||||
|
||||
@@ -6,8 +6,8 @@ HOMEPAGE="https://github.com/frankosterfeld/qtkeychain"
|
||||
COPYRIGHT="2011-2016 Frank Osterfeld, Mathias Hasselmann"
|
||||
LICENSE="BSD (2-clause)" #XXX: modified
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/frankosterfeld/qtkeychain/archive/v0.9.1.tar.gz"
|
||||
CHECKSUM_SHA256="9c2762d9d0759a65cdb80106d547db83c6e9fdea66f1973c6e9014f867c6f28e"
|
||||
SOURCE_URI="https://github.com/frankosterfeld/qtkeychain/archive/v$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="5f916cd97843de550467db32d2e10f218b904af5b21cfdfcc7c6425d7dfc3ec2"
|
||||
SOURCE_DIR="qtkeychain-$portVersion"
|
||||
PATCHES="qtkeychain-$portVersion.patchset"
|
||||
|
||||
@@ -46,33 +46,33 @@ BUILD_PREREQUIRES="
|
||||
|
||||
BUILD()
|
||||
{
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$prefix \
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake $cmakeDirArgs \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DINTERFACE_INCLUDE_SUFFIX=$relativeIncludeDir \
|
||||
-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
|
||||
-DQT_TRANSLATIONS_DIR=$dataDir/Qt5/translations \
|
||||
-Wno-dev
|
||||
-Wno-dev ..
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd build
|
||||
make install
|
||||
|
||||
# clean up after CMake
|
||||
mkdir -p $includeDir/qt5keychain/
|
||||
rm -rf $prefix/include/qt5keychain/CMakeFiles/
|
||||
mv $prefix/include/qt5keychain/* $includeDir/qt5keychain/
|
||||
rm -rf $prefix/include/
|
||||
rm -rf $includeDir/qt5keychain/CMakeFiles/
|
||||
|
||||
#mkdir -p $developLibDir/pkgconfig/
|
||||
#mv $prefix/lib/pkgconfig/* $developLibDir/pkgconfig/
|
||||
#rm -rf $prefix/lib/pkgconfig/
|
||||
|
||||
mkdir -p $libDir
|
||||
mv $prefix/lib/*.so* $libDir
|
||||
|
||||
prepareInstalledDevelLibs \
|
||||
libqt5keychain
|
||||
packageEntries devel \
|
||||
$developDir
|
||||
$developDir \
|
||||
$libDir/cmake \
|
||||
$dataDir/Qt5/mkspecs
|
||||
}
|
||||
Reference in New Issue
Block a user