You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
8.3 KiB
225 lines
8.3 KiB
11 years ago
|
From 9cac9ef904042bb69fbda88386a38b50e536ac3a Mon Sep 17 00:00:00 2001
|
||
|
From: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
|
||
|
Date: Mon, 31 Dec 2012 15:11:23 +0100
|
||
|
Subject: [PATCH 2/5] Full Qt 5 port.
|
||
|
|
||
|
[lkundrak@v3.sk: Rebased, squashed "Reintroduce ECM.
|
||
|
It's needed for KDEInstallDirs." in to fix build]
|
||
|
---
|
||
|
CMakeLists.txt | 10 +++++++---
|
||
|
agent/CMakeLists.txt | 9 +++------
|
||
|
agent/polkitqt1-agent-listener.cpp | 2 +-
|
||
|
core/CMakeLists.txt | 7 ++-----
|
||
|
core/polkitqt1-authority.cpp | 16 ++++++++--------
|
||
|
gui/CMakeLists.txt | 2 ++
|
||
|
polkit-qt-agent-1.pc.cmake | 2 +-
|
||
|
polkit-qt-core-1.pc.cmake | 2 +-
|
||
|
polkit-qt-gui-1.pc.cmake | 2 +-
|
||
|
9 files changed, 26 insertions(+), 26 deletions(-)
|
||
|
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index c760031..c6a2e28 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -2,17 +2,21 @@
|
||
|
project("PolkitQt-1")
|
||
|
|
||
|
cmake_minimum_required(VERSION 2.8.11)
|
||
|
+find_package(ECM 0.0.6 REQUIRED NO_MODULE)
|
||
|
+
|
||
|
+# Find includes in corresponding build directories
|
||
|
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||
|
|
||
|
# Instruct CMake to run moc automatically when needed
|
||
|
set(CMAKE_AUTOMOC ON)
|
||
|
|
||
|
-find_package(ECM 0.0.6 REQUIRED NO_MODULE)
|
||
|
-
|
||
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||
|
|
||
|
-find_package(Qt5 5.1.0 REQUIRED COMPONENTS Core DBus Widgets Xml)
|
||
|
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
|
||
|
|
||
|
+find_package(Qt5Core REQUIRED)
|
||
|
+find_package(Qt5Gui REQUIRED)
|
||
|
+find_package(Qt5Widgets REQUIRED)
|
||
|
find_package(Polkit REQUIRED)
|
||
|
find_package(GObject REQUIRED)
|
||
|
find_package(GIO REQUIRED)
|
||
|
diff --git a/agent/CMakeLists.txt b/agent/CMakeLists.txt
|
||
|
index 4df7d62..47e649d 100644
|
||
|
--- a/agent/CMakeLists.txt
|
||
|
+++ b/agent/CMakeLists.txt
|
||
|
@@ -1,19 +1,16 @@
|
||
|
-include_directories(
|
||
|
- ${CMAKE_CURRENT_BINARY_DIR}
|
||
|
- ${CMAKE_CURRENT_SOURCE_DIR}
|
||
|
-)
|
||
|
-
|
||
|
set(polkit_qt_agent_SRCS
|
||
|
polkitqt1-agent-session.cpp
|
||
|
polkitqt1-agent-listener.cpp
|
||
|
listeneradapter.cpp
|
||
|
polkitqtlistener.cpp
|
||
|
)
|
||
|
+
|
||
|
add_library(polkit-qt-agent-1 SHARED ${polkit_qt_agent_SRCS})
|
||
|
|
||
|
+qt5_use_modules(polkit-qt-agent-1 Core)
|
||
|
+
|
||
|
target_link_libraries(polkit-qt-agent-1
|
||
|
${POLKIT_LIBRARIES}
|
||
|
- ${QT_QTCORE_LIBRARY}
|
||
|
${POLKIT_AGENT_LIBRARY}
|
||
|
polkit-qt-core-1
|
||
|
)
|
||
|
diff --git a/agent/polkitqt1-agent-listener.cpp b/agent/polkitqt1-agent-listener.cpp
|
||
|
index c96d242..a193d8b 100644
|
||
|
--- a/agent/polkitqt1-agent-listener.cpp
|
||
|
+++ b/agent/polkitqt1-agent-listener.cpp
|
||
|
@@ -90,7 +90,7 @@ bool Listener::registerListener(const PolkitQt1::Subject &subject, const QString
|
||
|
bool r = polkit_agent_register_listener(d->listener,
|
||
|
#endif
|
||
|
subject.subject(),
|
||
|
- objectPath.toAscii().data(),
|
||
|
+ objectPath.toLatin1().data(),
|
||
|
#ifndef POLKIT_QT_1_COMPATIBILITY_MODE
|
||
|
NULL,
|
||
|
#endif
|
||
|
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
|
||
|
index 5afdae4..1adf1f8 100644
|
||
|
--- a/core/CMakeLists.txt
|
||
|
+++ b/core/CMakeLists.txt
|
||
|
@@ -1,8 +1,3 @@
|
||
|
-include_directories(
|
||
|
- ${CMAKE_CURRENT_BINARY_DIR}
|
||
|
- ${CMAKE_CURRENT_SOURCE_DIR}
|
||
|
-)
|
||
|
-
|
||
|
set(polkit_qt_core_SRCS
|
||
|
polkitqt1-authority.cpp
|
||
|
polkitqt1-identity.cpp
|
||
|
@@ -14,6 +9,8 @@ set(polkit_qt_core_SRCS
|
||
|
|
||
|
add_library(polkit-qt-core-1 SHARED ${polkit_qt_core_SRCS})
|
||
|
|
||
|
+qt5_use_modules(polkit-qt-core-1 Core DBus Xml)
|
||
|
+
|
||
|
target_link_libraries(polkit-qt-core-1
|
||
|
${POLKIT_LIBRARIES}
|
||
|
${GLIB2_LIBRARIES}
|
||
|
diff --git a/core/polkitqt1-authority.cpp b/core/polkitqt1-authority.cpp
|
||
|
index 265fe70..62488ca 100644
|
||
|
--- a/core/polkitqt1-authority.cpp
|
||
|
+++ b/core/polkitqt1-authority.cpp
|
||
|
@@ -223,7 +223,7 @@ void Authority::Private::init()
|
||
|
if (!msg.arguments().isEmpty()) {
|
||
|
// this method returns a list with present seats
|
||
|
QList<QString> seats;
|
||
|
- qVariantValue<QDBusArgument> (msg.arguments()[0]) >> seats;
|
||
|
+ qvariant_cast<QDBusArgument> (msg.arguments()[0]) >> seats;
|
||
|
// it can be multiple seats present so connect all their signals
|
||
|
Q_FOREACH(const QString &seat, seats) {
|
||
|
seatSignalsConnect(seat);
|
||
|
@@ -267,7 +267,7 @@ void Authority::Private::dbusFilter(const QDBusMessage &message)
|
||
|
|
||
|
// TODO: Test this with the multiseat support
|
||
|
if (message.member() == "SeatAdded") {
|
||
|
- seatSignalsConnect(qVariantValue<QDBusObjectPath> (message.arguments()[0]).path());
|
||
|
+ seatSignalsConnect(qvariant_cast<QDBusObjectPath> (message.arguments()[0]).path());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
@@ -323,7 +323,7 @@ Authority::Result Authority::checkAuthorizationSync(const QString &actionId, con
|
||
|
|
||
|
pk_result = polkit_authority_check_authorization_sync(d->pkAuthority,
|
||
|
subject.subject(),
|
||
|
- actionId.toAscii().data(),
|
||
|
+ actionId.toLatin1().data(),
|
||
|
NULL,
|
||
|
(PolkitCheckAuthorizationFlags)(int)flags,
|
||
|
NULL,
|
||
|
@@ -358,7 +358,7 @@ void Authority::checkAuthorization(const QString &actionId, const Subject &subje
|
||
|
|
||
|
polkit_authority_check_authorization(d->pkAuthority,
|
||
|
subject.subject(),
|
||
|
- actionId.toAscii().data(),
|
||
|
+ actionId.toLatin1().data(),
|
||
|
NULL,
|
||
|
(PolkitCheckAuthorizationFlags)(int)flags,
|
||
|
d->m_checkAuthorizationCancellable,
|
||
|
@@ -470,8 +470,8 @@ bool Authority::registerAuthenticationAgentSync(const Subject &subject, const QS
|
||
|
}
|
||
|
|
||
|
result = polkit_authority_register_authentication_agent_sync(d->pkAuthority,
|
||
|
- subject.subject(), locale.toAscii().data(),
|
||
|
- objectPath.toAscii().data(), NULL, &error);
|
||
|
+ subject.subject(), locale.toLatin1().data(),
|
||
|
+ objectPath.toLatin1().data(), NULL, &error);
|
||
|
|
||
|
if (error) {
|
||
|
d->setError(E_RegisterFailed, error->message);
|
||
|
@@ -495,8 +495,8 @@ void Authority::registerAuthenticationAgent(const Subject &subject, const QStrin
|
||
|
|
||
|
polkit_authority_register_authentication_agent(d->pkAuthority,
|
||
|
subject.subject(),
|
||
|
- locale.toAscii().data(),
|
||
|
- objectPath.toAscii().data(),
|
||
|
+ locale.toLatin1().data(),
|
||
|
+ objectPath.toLatin1().data(),
|
||
|
d->m_registerAuthenticationAgentCancellable,
|
||
|
d->registerAuthenticationAgentCallback,
|
||
|
this);
|
||
|
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
|
||
|
index 47ac74d..00d111d 100644
|
||
|
--- a/gui/CMakeLists.txt
|
||
|
+++ b/gui/CMakeLists.txt
|
||
|
@@ -6,6 +6,8 @@ set(polkit_qt_gui_SRCS
|
||
|
|
||
|
add_library(polkit-qt-gui-1 SHARED ${polkit_qt_gui_SRCS})
|
||
|
|
||
|
+qt5_use_modules(polkit-qt-gui-1 Core DBus Gui Widgets)
|
||
|
+
|
||
|
target_link_libraries(polkit-qt-gui-1
|
||
|
${POLKIT_LIBRARIES}
|
||
|
polkit-qt-core-1
|
||
|
diff --git a/polkit-qt-agent-1.pc.cmake b/polkit-qt-agent-1.pc.cmake
|
||
|
index 09f9323..dbf0ba4 100644
|
||
|
--- a/polkit-qt-agent-1.pc.cmake
|
||
|
+++ b/polkit-qt-agent-1.pc.cmake
|
||
|
@@ -6,6 +6,6 @@ includedir=@CMAKE_INSTALL_PREFIX@/include
|
||
|
Name: polkit-qt-agent-1
|
||
|
Description: Convenience library for using polkit Agent with a Qt-styled API
|
||
|
Version: @POLKITQT-1_VERSION_STRING@
|
||
|
-Requires: QtCore QtGui
|
||
|
+Requires: Qt5Core Qt5Gui
|
||
|
Libs: -L${libdir} -lpolkit-qt-agent-1
|
||
|
Cflags: -I${includedir}
|
||
|
diff --git a/polkit-qt-core-1.pc.cmake b/polkit-qt-core-1.pc.cmake
|
||
|
index f553b7b..d5f16b8 100644
|
||
|
--- a/polkit-qt-core-1.pc.cmake
|
||
|
+++ b/polkit-qt-core-1.pc.cmake
|
||
|
@@ -6,6 +6,6 @@ includedir=@CMAKE_INSTALL_PREFIX@/include
|
||
|
Name: polkit-qt-core-1
|
||
|
Description: Convenience library for using polkit with a Qt-styled API, non-GUI classes
|
||
|
Version: @POLKITQT-1_VERSION_STRING@
|
||
|
-Requires: QtCore
|
||
|
+Requires: Qt5Core
|
||
|
Libs: -L${libdir} -lpolkit-qt-core-1
|
||
|
Cflags: -I${includedir}
|
||
|
diff --git a/polkit-qt-gui-1.pc.cmake b/polkit-qt-gui-1.pc.cmake
|
||
|
index 83d4e9a..b211881 100644
|
||
|
--- a/polkit-qt-gui-1.pc.cmake
|
||
|
+++ b/polkit-qt-gui-1.pc.cmake
|
||
|
@@ -6,6 +6,6 @@ includedir=@CMAKE_INSTALL_PREFIX@/include
|
||
|
Name: polkit-qt-gui-1
|
||
|
Description: Convenience library for using polkit with a Qt-styled API, GUI classes
|
||
|
Version: @POLKITQT-1_VERSION_STRING@
|
||
|
-Requires: QtCore QtGui polkit-qt-core-1
|
||
|
+Requires: Qt5Core Qt5Gui Qt5Widgets polkit-qt-core-1
|
||
|
Libs: -L${libdir} -lpolkit-qt-gui-1
|
||
|
Cflags: -I${includedir}
|
||
|
--
|
||
|
1.8.5.3
|
||
|
|