osc copypac from project:KDE:Unstable:Frameworks package:polkit-kde-agent-5 revision:6

OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/polkit-kde-agent-5?expand=0&rev=1
This commit is contained in:
Hrvoje Senjan 2014-07-04 11:28:29 +00:00 committed by Git OBS Bridge
commit b172715bcd
16 changed files with 759 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,33 @@
From 0701f84a57156f8f584bb4fe928811a26ceefcf0 Mon Sep 17 00:00:00 2001
From: Jonathan Thomas <echidnaman@kubuntu.org>
Date: Wed, 19 Jan 2011 10:21:53 -0500
Subject: [PATCH 1/1] Bring the auth dialog to the front when it is shown.
Otherwise it pops up behind the app requesting it and the user never sees it.
---
policykitlistener.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/policykitlistener.cpp b/policykitlistener.cpp
index 68185bc..bb95f1d 100644
--- a/policykitlistener.cpp
+++ b/policykitlistener.cpp
@@ -22,6 +22,7 @@
#include "AuthDialog.h"
#include <KDebug>
+#include <KWindowSystem>
#include <PolkitQt1/Agent/Listener>
#include <PolkitQt1/Agent/Session>
@@ -100,6 +101,7 @@ void PolicyKitListener::initiateAuthentication(const QString &actionId,
kDebug() << "WinId of the dialog is " << m_dialog.data()->winId() << m_dialog.data()->effectiveWinId();
m_dialog.data()->setOptions();
m_dialog.data()->show();
+ KWindowSystem::forceActiveWindow(m_dialog.data()->winId());
kDebug() << "WinId of the shown dialog is " << m_dialog.data()->winId() << m_dialog.data()->effectiveWinId();
m_numTries = 0;
--
1.9.3

View File

@ -0,0 +1,26 @@
From 15e55a4ee14d93343aa07615034718a39fbcc222 Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Thu, 18 Aug 2011 02:01:12 +0400
Subject: [PATCH 1/1] Don't try to install files outside CMAKE_INSTALL_PREFIX
KDE4_AUTOSTART_INSTALL_DIR points to kdelibs prefix,
not current CMAKE_INSTALL_PREFIX. Use AUTOSTART_INSTALL_DIR instead.
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e8953a6..f79b88f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,6 @@ configure_file(polkit-kde-authentication-agent-1.desktop.in ${CMAKE_BINARY_DIR}/
install(TARGETS polkit-kde-authentication-agent-1 DESTINATION ${LIBEXEC_INSTALL_DIR})
-install(FILES ${CMAKE_BINARY_DIR}/polkit-kde-authentication-agent-1.desktop DESTINATION ${KDE4_AUTOSTART_INSTALL_DIR})
+install(FILES ${CMAKE_BINARY_DIR}/polkit-kde-authentication-agent-1.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
install(FILES policykit1-kde.notifyrc DESTINATION ${DATA_INSTALL_DIR}/policykit1-kde)
--
1.9.3

View File

@ -0,0 +1,34 @@
From 34b6e24316e83bb13bb1b420616bc986783bb249 Mon Sep 17 00:00:00 2001
From: Jonathan Thomas <echidnaman@kubuntu.org>
Date: Sat, 22 Oct 2011 19:31:55 -0400
Subject: [PATCH 1/1] Autorestart when we crash. This way a polkit-kde-1 crash
won't prevent polkit auth from working until the next login.
---
main.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/main.cpp b/main.cpp
index e197cee..2fa928f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -21,6 +21,7 @@
#include <KCmdLineArgs>
#include <KAboutData>
#include <KLocale>
+#include <KCrash>
#include "policykitkde.h"
@@ -32,6 +33,8 @@ int main(int argc, char *argv[])
aboutData.addAuthor(ki18n("Jaroslav Reznik"), ki18n("Maintainer"), "jreznik@redhat.com");
aboutData.setProductName("policykit-kde/polkit-kde-authentication-agent-1");
+ KCrash::setFlags(KCrash::AutoRestart);
+
KCmdLineArgs::init(argc, argv, &aboutData);
if (!PolicyKitKDE::start()) {
--
1.9.3

View File

@ -0,0 +1,30 @@
From 599b36eddd2ae4d8d2967255c503a680002dabf7 Mon Sep 17 00:00:00 2001
From: Jonathan Thomas <echidnaman@kubuntu.org>
Date: Tue, 25 Oct 2011 17:28:38 -0400
Subject: [PATCH 1/1] Of course, we can only set KCrash flags after
KCmdLineArgs::init() has been called
---
main.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/main.cpp b/main.cpp
index 2fa928f..ab359b7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -33,10 +33,10 @@ int main(int argc, char *argv[])
aboutData.addAuthor(ki18n("Jaroslav Reznik"), ki18n("Maintainer"), "jreznik@redhat.com");
aboutData.setProductName("policykit-kde/polkit-kde-authentication-agent-1");
- KCrash::setFlags(KCrash::AutoRestart);
-
KCmdLineArgs::init(argc, argv, &aboutData);
+ KCrash::setFlags(KCrash::AutoRestart);
+
if (!PolicyKitKDE::start()) {
qWarning("PolicyKitKDE is already running!\n");
return 0;
--
1.9.3

View File

@ -0,0 +1,58 @@
From 27cfdc75084e57f22ba93c54f2387a7c47378d90 Mon Sep 17 00:00:00 2001
From: Felix Geyer <debfx-kde@fobos.de>
Date: Tue, 8 Nov 2011 20:44:05 +0100
Subject: [PATCH 1/1] Remove unused "Remember authorization" checkboxes.
The checkboxes were visible in the UI but the feature
isn't actually implemented.
---
AuthDialog.ui | 33 ---------------------------------
1 file changed, 33 deletions(-)
diff --git a/AuthDialog.ui b/AuthDialog.ui
index 27480ff..3b9bbc6 100644
--- a/AuthDialog.ui
+++ b/AuthDialog.ui
@@ -114,39 +114,6 @@
</property>
</widget>
</item>
- <item row="4" column="1" colspan="3" >
- <widget class="QCheckBox" name="cbRemember" >
- <property name="text" >
- <string>Remember authorization</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="2" colspan="2" >
- <widget class="QCheckBox" name="cbSessionOnly" >
- <property name="text" >
- <string>For this session only</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>15</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
<item row="1" column="1" colspan="3" >
<widget class="KComboBox" name="userCB" />
</item>
--
1.9.3

View File

@ -0,0 +1,37 @@
From 3a9906d2b5d1c504670442277906ed53cd9686e8 Mon Sep 17 00:00:00 2001
From: Dario Freddi <drf@kde.org>
Date: Fri, 25 Nov 2011 23:08:07 +0100
Subject: [PATCH 1/1] CCMAIL: echidnaman@kubuntu.org
KCrash must be initialized after KUniqueApplication is started, to avoid KCmdLine to parse its arguments before that.
P.S.: While I do appreciate the contribution and I think the patch was really useful,
it would be awesome if those changes went through review first. If they went through and I forgot
about it and didn't spot the problem earlier, feel free to hit me with a stick instead.
---
main.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/main.cpp b/main.cpp
index ab359b7..33ef236 100644
--- a/main.cpp
+++ b/main.cpp
@@ -35,13 +35,13 @@ int main(int argc, char *argv[])
KCmdLineArgs::init(argc, argv, &aboutData);
- KCrash::setFlags(KCrash::AutoRestart);
-
if (!PolicyKitKDE::start()) {
qWarning("PolicyKitKDE is already running!\n");
return 0;
}
+ KCrash::setFlags(KCrash::AutoRestart);
+
PolicyKitKDE agent;
agent.disableSessionManagement();
agent.exec();
--
1.9.3

View File

@ -0,0 +1,27 @@
From 159e5e09fdecd0ebeaf311660633cf026a4ef27c Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <tsdgeos@terra.es>
Date: Tue, 13 Dec 2011 09:28:45 +0100
Subject: [PATCH 1/1] Use i18n instead of concatenating strings that are shown
to the user
REVIEW: 103400
---
AuthDialog.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/AuthDialog.cpp b/AuthDialog.cpp
index 4450052..d698f79 100644
--- a/AuthDialog.cpp
+++ b/AuthDialog.cpp
@@ -207,7 +207,7 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
// Display user Full Name IF available
QString display;
if (!user.property(KUser::FullName).toString().isEmpty()) {
- display = user.property(KUser::FullName).toString() + " (" + user.loginName() + ')';
+ display = i18nc("%1 is the full user name, %2 is the user login name", "%1 (%2)", user.property(KUser::FullName).toString(), user.loginName());
} else {
display = user.loginName();
}
--
1.9.3

View File

@ -0,0 +1,50 @@
From df12892c7a8b1475b6590186f590b349f52a54d4 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <tsdgeos@terra.es>
Date: Tue, 13 Dec 2011 09:35:39 +0100
Subject: [PATCH 1/1] Choose the current user in the combobox if it is present
REVIEW: 103399
---
AuthDialog.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/AuthDialog.cpp b/AuthDialog.cpp
index d698f79..2aa3f2d 100644
--- a/AuthDialog.cpp
+++ b/AuthDialog.cpp
@@ -195,10 +195,13 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
qobject_cast<QStandardItemModel *>(userCB->model())->item(userCB->count()-1)->setEnabled(false);
// For each user
+ int index = 1; // Start at 1 because of the "Select User" entry
+ int currentUserIndex = -1;
+ const KUser currentUser;
foreach(const PolkitQt1::Identity &identity, identities) {
// First check to see if the user is valid
kDebug() << "User: " << identity.toString();
- KUser user(identity.toString().remove("unix-user:"));
+ const KUser user(identity.toString().remove("unix-user:"));
if (!user.isValid()) {
kWarning() << "User invalid: " << user.loginName();
continue;
@@ -221,9 +224,17 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
}
// appends the user item
userCB->addItem(icon, display, qVariantFromValue<QString> (identity.toString()));
+
+ if (user == currentUser) {
+ currentUserIndex = index;
+ }
+ ++index;
}
// Show the widget and set focus
+ if (currentUserIndex != -1) {
+ userCB->setCurrentIndex(currentUserIndex);
+ }
userCB->show();
userCB->setFocus();
}
--
1.9.3

View File

@ -0,0 +1,50 @@
From 5f5636192e50f7d1a2d1345168bdd4e471d6bfed Mon Sep 17 00:00:00 2001
From: Dario Freddi <drf@kde.org>
Date: Mon, 30 Jan 2012 02:45:53 +0100
Subject: [PATCH 1/1] Normalize connect calls
---
AuthDialog.cpp | 6 +++---
policykitlistener.cpp | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/AuthDialog.cpp b/AuthDialog.cpp
index 2aa3f2d..34aac16 100644
--- a/AuthDialog.cpp
+++ b/AuthDialog.cpp
@@ -302,7 +302,7 @@ void AuthDialog::showEvent(QShowEvent *event)
notification->setPixmap(icon);
notification->setActions(QStringList() << i18n("Switch to dialog") << i18n("Cancel"));
- connect(notification, SIGNAL(activated(unsigned int)), this, SLOT(notificationActivated(unsigned int)));
+ connect(notification, SIGNAL(activated(uint)), this, SLOT(notificationActivated(uint)));
notification->sendEvent();
}
@@ -361,8 +361,8 @@ AuthDetails::AuthDetails(const PolkitQt1::Details &details,
vendorUL->hide();
}
- connect(vendorUL, SIGNAL(leftClickedUrl(const QString&)), SLOT(openUrl(const QString&)));
- connect(action_label, SIGNAL(leftClickedUrl(const QString&)), SLOT(openAction(const QString&)));
+ connect(vendorUL, SIGNAL(leftClickedUrl(QString)), SLOT(openUrl(QString)));
+ connect(action_label, SIGNAL(leftClickedUrl(QString)), SLOT(openAction(QString)));
}
void AuthDetails::openUrl(const QString& url)
diff --git a/policykitlistener.cpp b/policykitlistener.cpp
index bb95f1d..459b73f 100644
--- a/policykitlistener.cpp
+++ b/policykitlistener.cpp
@@ -117,7 +117,7 @@ void PolicyKitListener::tryAgain()
// We will create new session only when some user is selected
if (m_selectedUser.isValid()) {
m_session = new Session(m_selectedUser, m_cookie, m_result);
- connect(m_session.data(), SIGNAL(request(QString, bool)), this, SLOT(request(QString, bool)));
+ connect(m_session.data(), SIGNAL(request(QString,bool)), this, SLOT(request(QString,bool)));
connect(m_session.data(), SIGNAL(completed(bool)), this, SLOT(completed(bool)));
connect(m_session.data(), SIGNAL(showError(QString)), this, SLOT(showError(QString)));
--
1.9.3

View File

@ -0,0 +1,54 @@
From b709d88f46a382937635b424d2b04ac70ad16dbc Mon Sep 17 00:00:00 2001
From: Philip Muskovac <yofel@gmx.net>
Date: Tue, 14 Aug 2012 19:30:30 +0200
Subject: [PATCH 1/1] fix crash when more than one user exists and we
pre-select one
REVIEW: 106006
---
AuthDialog.cpp | 1 -
policykitlistener.cpp | 9 ++++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/AuthDialog.cpp b/AuthDialog.cpp
index 34aac16..f2c4886 100644
--- a/AuthDialog.cpp
+++ b/AuthDialog.cpp
@@ -236,7 +236,6 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
userCB->setCurrentIndex(currentUserIndex);
}
userCB->show();
- userCB->setFocus();
}
}
diff --git a/policykitlistener.cpp b/policykitlistener.cpp
index 459b73f..6da9461 100644
--- a/policykitlistener.cpp
+++ b/policykitlistener.cpp
@@ -81,9 +81,6 @@ void PolicyKitListener::initiateAuthentication(const QString &actionId,
m_cookie = cookie;
m_result = result;
m_session.clear();
- if (identities.length() == 1) {
- m_selectedUser = identities[0];
- }
m_inProgress = true;
@@ -104,6 +101,12 @@ void PolicyKitListener::initiateAuthentication(const QString &actionId,
KWindowSystem::forceActiveWindow(m_dialog.data()->winId());
kDebug() << "WinId of the shown dialog is " << m_dialog.data()->winId() << m_dialog.data()->effectiveWinId();
+ if (identities.length() == 1) {
+ m_selectedUser = identities[0];
+ } else {
+ m_selectedUser = m_dialog.data()->adminUserSelected();
+ }
+
m_numTries = 0;
tryAgain();
}
--
1.9.3

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6180499cda40ba6e177ca5e6ed1c526c49604bccbbe91b7f3fb2188cebe9be1d
size 17507

View File

@ -0,0 +1,38 @@
-------------------------------------------------------------------
Tue Jul 16 17:40:39 UTC 2013 - hrvoje.senjan@gmail.com
- Drop polkit-kde-kcmmodules-1 requires, the agent doesn't depend
on that package
-------------------------------------------------------------------
Fri Mar 1 06:19:20 UTC 2013 - coolo@suse.com
- update license to new format
-------------------------------------------------------------------
Mon Sep 5 06:08:06 UTC 2011 - mlin@suse.com
- add %kde4_runtime_requires macro to have the right versioned
dependency
-------------------------------------------------------------------
Thu Aug 18 13:13:04 UTC 2011 - toddrme2178@gmail.com
- Updated URL
- Removed redundant buildrequires
- Added %suse_update_desktop_file (fix for RPMLINT warning)
- Added %kde_post_install (fix for RPMLINT warning)
- Cleaned up spec file formatting
- Cleaned up changes file formatting
-------------------------------------------------------------------
Thu Dec 9 09:20:06 UTC 2010 - tittiatcoke@gmail.com
- Update to 0.99.0
* Requires Polkit-qt-1 v0.99.1
-------------------------------------------------------------------
Tue Oct 26 17:03:21 UTC 2010 - tittiatcoke@gmail.com
- Initial version 0.98.1

76
polkit-kde-agent-5.spec Normal file
View File

@ -0,0 +1,76 @@
#
# spec file for package polkit-kde-agent-1
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: polkit-kde-agent-5
Version: 0.99.0
Release: 0
Summary: PolicyKit authentication agent for KDE
License: GPL-2.0 and LGPL-2.1+
Group: Development/Libraries/KDE
Url: https://projects.kde.org/projects/extragear/base/polkit-kde-agent-1
# ftp://ftp.kde.org/pub/kde/stable/apps/KDE4.x/admin/
Source0: polkit-kde-agent-1-%{version}.tar.bz2
Patch0: 0001-Bring-the-auth-dialog-to-the-front-when-it-is-shown..patch
Patch1: 0002-Don-t-try-to-install-files-outside-CMAKE_INSTALL_PRE.patch
Patch2: 0003-Autorestart-when-we-crash.-This-way-a-polkit-kde-1-c.patch
Patch3: 0004-Of-course-we-can-only-set-KCrash-flags-after-KCmdLin.patch
Patch4: 0005-Remove-unused-Remember-authorization-checkboxes.patch
Patch5: 0006-CCMAIL-echidnaman-kubuntu.org.patch
Patch6: 0007-Use-i18n-instead-of-concatenating-strings-that-are-s.patch
Patch7: 0008-Choose-the-current-user-in-the-combobox-if-it-is-pre.patch
Patch8: 0009-Normalize-connect-calls.patch
Patch9: 0010-fix-crash-when-more-than-one-user-exists-and-we-pre-.patch
Patch10: qt5.patch
BuildRequires: kf5-filesystem
BuildRequires: extra-cmake-modules
BuildRequires: kdelibs4support-devel
BuildRequires: kiconthemes-devel
BuildRequires: libpolkit-qt5-1-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Provides Policy Kit Authentication Agent that nicely fits to KDE.
%prep
%setup -q -n polkit-kde-agent-1-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
%cmake_kf5 -d build -- -DLIBEXEC_INSTALL_DIR=%{_kf5_libdir}/libexec
%make_jobs
%install
%kf5_makeinstall -C build
%files
%defattr(-,root,root)
%{_kf5_configdir}/autostart/polkit-kde-authentication-agent-5.desktop
%{_kf5_libdir}/libexec/polkit-kde-authentication-agent-5
%{_kf5_sharedir}/policykit1-kde/
%changelog

219
qt5.patch Normal file
View File

@ -0,0 +1,219 @@
diff --git a/AuthDialog.cpp b/AuthDialog.cpp
index f2c4886..7ccc6da 100644
--- a/AuthDialog.cpp
+++ b/AuthDialog.cpp
@@ -27,6 +27,7 @@
#include <QtGui/QPainter>
#include <QtGui/QStandardItemModel>
#include <KDebug>
+#include <KLocale>
#include <KToolInvocation>
#include <KUser>
@@ -36,6 +37,8 @@
#include <KWindowSystem>
#include <KNotification>
+#include <KIconLoader>
+#include <KIcon>
AuthDialog::AuthDialog(const QString &actionId,
const QString &message,
@@ -215,15 +218,13 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
display = user.loginName();
}
- KIcon icon;
// load user icon face
+ // appends the user item
if (!user.faceIconPath().isEmpty()) {
- icon = KIcon(user.faceIconPath());
+ userCB->addItem(KIcon(user.faceIconPath()), display, qVariantFromValue<QString> (identity.toString()));
} else {
- icon = KIcon("user-identity");
+ userCB->addItem(KIcon("user-identity"), display, qVariantFromValue<QString> (identity.toString()));
}
- // appends the user item
- userCB->addItem(icon, display, qVariantFromValue<QString> (identity.toString()));
if (user == currentUser) {
currentUserIndex = index;
diff --git a/AuthDialog.h b/AuthDialog.h
index 620145d..594690a 100644
--- a/AuthDialog.h
+++ b/AuthDialog.h
@@ -26,6 +26,8 @@
#include "ui_AuthDialog.h"
#include "ui_authdetails.h"
+#include <KDialog>
+
#include <PolkitQt1/Identity>
#include <PolkitQt1/ActionDescription>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f79b88f..f32db2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,39 +1,86 @@
+cmake_minimum_required(VERSION 2.8.12)
project(polkit-kde-agent-1)
+option(USE_QT4 "Use KDE4 and Qt4 to compile the agent" OFF)
+option(USE_QT5 "Use KF5 and Qt5 to compile the agent" OFF)
+
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
-find_package(KDE4 REQUIRED)
+if(NOT USE_QT4 AND NOT USE_QT5)
+ # Autodetect, prefering Qt 5
+ message(STATUS "Autodetecting Qt version to use")
+ find_package(Qt5Core QUIET)
+ if(NOT Qt5Core_FOUND)
+ message(STATUS "Qt5 not found, defaulting to Qt4")
+ set(USE_QT4 TRUE)
+ else()
+ message(STATUS "Qt5 found")
+ endif()
+endif()
+
+
+if(USE_QT4)
+ set(POLKITQT-1_MIN_VERSION "0.99.0")
+ find_package(PolkitQt-1 REQUIRED)
+ find_package(KDE4 REQUIRED)
+
+ set(KDEx_LIBRARIES ${KDE4_KDEUI_LIBS} )
+ set(KDEx_INCLUDES ${KDE4_INCLUDES} )
+ set(AGENT_NAME "polkit-kde-authentication-agent-1")
+
+ qt4_add_dbus_adaptor(policykit_SRCS org.kde.Polkit1AuthAgent.xml policykitlistener.h PolicyKitListener)
+ qt4_wrap_ui(policykit_SRCS AuthDialog.ui authdetails.ui)
+else()
+ set(POLKITQT5-1_MIN_VERSION "0.99.0")
+ find_package(PolkitQt5-1 REQUIRED)
+ find_package(ECM REQUIRED NO_MODULE)
+ find_package(Qt5 REQUIRED Core DBus)
+ find_package(KF5KDELibs4Support)
+ find_package(KF5IconThemes)
+ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
-set(POLKITQT-1_MIN_VERSION "0.99.0")
-find_package(PolkitQt-1 REQUIRED)
+ include(KDEInstallDirs)
+ include(KDECompilerSettings)
+ include(KDECMakeSettings)
+ include(FeatureSummary)
-include_directories(${KDE4_INCLUDES}
+ set(KDEx_LIBRARIES KF5::KDELibs4Support KF5::IconThemes)
+ set(KDEx_INCLUDES )
+ set(AGENT_NAME "polkit-kde-authentication-agent-5")
+
+ qt5_add_dbus_adaptor(policykit_SRCS org.kde.Polkit1AuthAgent.xml policykitlistener.h PolicyKitListener)
+ qt5_wrap_ui(policykit_SRCS AuthDialog.ui authdetails.ui)
+endif()
+
+set(CMAKE_AUTOMOC TRUE)
+add_definitions( -DAGENT_NAME=\"${AGENT_NAME}\" )
+
+
+include_directories(${KDEx_INCLUDES}
${POLKITQT-1_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
set(policykit_SRCS
+ ${policykit_SRCS}
policykitkde.cpp
policykitlistener.cpp
main.cpp
AuthDialog.cpp
)
-qt4_add_dbus_adaptor(policykit_SRCS org.kde.Polkit1AuthAgent.xml policykitlistener.h PolicyKitListener)
-
-kde4_add_ui_files(policykit_SRCS AuthDialog.ui authdetails.ui)
-kde4_add_executable(polkit-kde-authentication-agent-1 ${policykit_SRCS})
+add_executable(${AGENT_NAME} ${policykit_SRCS})
-target_link_libraries(polkit-kde-authentication-agent-1
- ${KDE4_KDEUI_LIBS}
- ${POLKITQT-1_LIBRARIES}
+target_link_libraries(${AGENT_NAME}
+ ${POLKITQT-1_LIBRARIES}
+ ${KDEx_LIBRARIES}
)
-configure_file(polkit-kde-authentication-agent-1.desktop.in ${CMAKE_BINARY_DIR}/polkit-kde-authentication-agent-1.desktop)
+configure_file(polkit-kde-authentication-agent-1.desktop.in ${CMAKE_BINARY_DIR}/${AGENT_NAME}.desktop)
-install(TARGETS polkit-kde-authentication-agent-1 DESTINATION ${LIBEXEC_INSTALL_DIR})
+install(TARGETS ${AGENT_NAME} DESTINATION ${LIBEXEC_INSTALL_DIR})
-install(FILES ${CMAKE_BINARY_DIR}/polkit-kde-authentication-agent-1.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
+install(FILES ${CMAKE_BINARY_DIR}/${AGENT_NAME}.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
install(FILES policykit1-kde.notifyrc DESTINATION ${DATA_INSTALL_DIR}/policykit1-kde)
diff --git a/main.cpp b/main.cpp
index 33ef236..943d19c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -18,8 +18,15 @@
*/
+#include <QtGlobal>
+#if QT_VERSION >= 0x050000
+# include <K4AboutData>
+#else
+# include <KAboutData>
+# define K4AboutData KAboutData
+#endif
+
#include <KCmdLineArgs>
-#include <KAboutData>
#include <KLocale>
#include <KCrash>
@@ -27,11 +34,11 @@
int main(int argc, char *argv[])
{
- KAboutData aboutData("Polkit1AuthAgent", "polkit-kde-authentication-agent-1", ki18n("PolicyKit1-KDE"), "0.99.0",
- ki18n("PolicyKit1-KDE"), KAboutData::License_GPL,
+ K4AboutData aboutData("Polkit1AuthAgent", AGENT_NAME, ki18n("PolicyKit1-KDE"), "0.99.0",
+ ki18n("PolicyKit1-KDE"), K4AboutData::License_GPL,
ki18n("(c) 2009 Red Hat, Inc."));
aboutData.addAuthor(ki18n("Jaroslav Reznik"), ki18n("Maintainer"), "jreznik@redhat.com");
- aboutData.setProductName("policykit-kde/polkit-kde-authentication-agent-1");
+ aboutData.setProductName(AGENT_NAME);
KCmdLineArgs::init(argc, argv, &aboutData);
diff --git a/policykitlistener.cpp b/policykitlistener.cpp
index 6da9461..0e96863 100644
--- a/policykitlistener.cpp
+++ b/policykitlistener.cpp
@@ -23,6 +23,7 @@
#include <KDebug>
#include <KWindowSystem>
+#include <KLocale>
#include <PolkitQt1/Agent/Listener>
#include <PolkitQt1/Agent/Session>
diff --git a/polkit-kde-authentication-agent-1.desktop.in b/polkit-kde-authentication-agent-1.desktop.in
index aa088cc..40ae52c 100644
--- a/polkit-kde-authentication-agent-1.desktop.in
+++ b/polkit-kde-authentication-agent-1.desktop.in
@@ -16,7 +16,7 @@ Comment[pt]=Agente de Autenticação do PolicyKit
Comment[sv]=Policykit behörighetskontrollverktyg
Comment[uk]=Агент розпізнавання PolicyKit
Comment[x-test]=xxPolicyKit Authentication Agentxx
-Exec=${LIBEXEC_INSTALL_DIR}/polkit-kde-authentication-agent-1
+Exec=${LIBEXEC_INSTALL_DIR}/${AGENT_NAME}
Terminal=false
Type=Application
Categories=