Browse Source
https://snapshot.debian.org/package/polkit-kde-1/0.99.1-1/ Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>master
commit
25813d39a5
126 changed files with 9118 additions and 0 deletions
@ -0,0 +1,377 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Gรถkรงen Eraslan <gokcen@pardus.org.tr> |
||||
Copyright (C) 2008 Dirk Mueller <mueller@kde.org> |
||||
Copyright (C) 2008 Daniel Nicoletti <dantti85-pk@yahoo.com.br> |
||||
Copyright (C) 2008-2010 Dario Freddi <drf@kde.org> |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public |
||||
License as published by the Free Software Foundation; either |
||||
version 2 of the License, or (at your option) any later version. |
||||
|
||||
This library is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
Library General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Library General Public License |
||||
along with this library; see the file COPYING.LIB. If not, write to |
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
||||
Boston, MA 02110-1301, USA. |
||||
|
||||
*/ |
||||
|
||||
#include "AuthDialog.h" |
||||
|
||||
#include <QtCore/QProcess> |
||||
#include <QtGui/QPainter> |
||||
#include <QtGui/QStandardItemModel> |
||||
#include <KDebug> |
||||
|
||||
#include <KToolInvocation> |
||||
#include <KUser> |
||||
|
||||
#include <PolkitQt1/Authority> |
||||
#include <PolkitQt1/Details> |
||||
|
||||
#include <KWindowSystem> |
||||
#include <KNotification> |
||||
|
||||
AuthDialog::AuthDialog(const QString &actionId, |
||||
const QString &message, |
||||
const QString &iconName, |
||||
const PolkitQt1::Details &details, |
||||
const PolkitQt1::Identity::List &identities, |
||||
WId parent) |
||||
: KDialog(0) |
||||
{ |
||||
// KAuth is able to circumvent polkit's limitations, and manages to send the wId to the auth agent.
|
||||
// If we received it, we use KWindowSystem to associate this dialog correctly.
|
||||
if (parent > 0) { |
||||
kDebug() << "Associating the dialog with " << parent << " this dialog is " << winId(); |
||||
|
||||
// Set the parent
|
||||
KWindowSystem::setMainWindow(this, parent); |
||||
|
||||
// Set modal
|
||||
KWindowSystem::setState(winId(), NET::Modal); |
||||
} |
||||
|
||||
setupUi(mainWidget()); |
||||
setButtons(Ok | Cancel | Details); |
||||
|
||||
if (message.isEmpty()) { |
||||
kWarning() << "Could not get action message for action."; |
||||
lblHeader->hide(); |
||||
} else { |
||||
kDebug() << "Message of action: " << message; |
||||
lblHeader->setText("<h3>" + message + "</h3>"); |
||||
setCaption(message); |
||||
m_message = message; |
||||
} |
||||
|
||||
// loads the standard key icon
|
||||
QPixmap icon = KIconLoader::global()->loadIcon("dialog-password", |
||||
KIconLoader::NoGroup, |
||||
KIconLoader::SizeHuge, |
||||
KIconLoader::DefaultState); |
||||
// create a painter to paint the action icon over the key icon
|
||||
QPainter painter(&icon); |
||||
const int iconSize = icon.size().width(); |
||||
// the the emblem icon to size 32
|
||||
int overlaySize = 32; |
||||
// try to load the action icon
|
||||
const QPixmap pixmap = KIconLoader::global()->loadIcon(iconName, |
||||
KIconLoader::NoGroup, |
||||
overlaySize, |
||||
KIconLoader::DefaultState, |
||||
QStringList(), |
||||
0, |
||||
true); |
||||
// if we're able to load the action icon paint it over the
|
||||
// key icon.
|
||||
if (!pixmap.isNull()) { |
||||
QPoint startPoint; |
||||
// bottom right corner
|
||||
startPoint = QPoint(iconSize - overlaySize - 2, |
||||
iconSize - overlaySize - 2); |
||||
painter.drawPixmap(startPoint, pixmap); |
||||
} |
||||
|
||||
setWindowIcon(icon); |
||||
lblPixmap->setPixmap(icon); |
||||
|
||||
// find action description for actionId
|
||||
foreach(const PolkitQt1::ActionDescription &desc, PolkitQt1::Authority::instance()->enumerateActionsSync()) { |
||||
if (actionId == desc.actionId()) { |
||||
m_actionDescription = desc; |
||||
kDebug() << "Action description has been found" ; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
AuthDetails *detailsDialog = new AuthDetails(details, m_actionDescription, m_appname, this); |
||||
setDetailsWidget(detailsDialog); |
||||
|
||||
userCB->hide(); |
||||
lePassword->setFocus(); |
||||
|
||||
errorMessageKTW->hide(); |
||||
|
||||
// If there is more than 1 identity we will show the combobox for user selection
|
||||
if (identities.size() > 1) { |
||||
connect(userCB, SIGNAL(currentIndexChanged(int)), |
||||
this, SLOT(on_userCB_currentIndexChanged(int))); |
||||
|
||||
createUserCB(identities); |
||||
} else { |
||||
userCB->addItem("", QVariant(identities[0].toString())); |
||||
userCB->setCurrentIndex(0); |
||||
} |
||||
} |
||||
|
||||
AuthDialog::~AuthDialog() |
||||
{ |
||||
} |
||||
|
||||
void AuthDialog::accept() |
||||
{ |
||||
// Do nothing, do not close the dialog. This is needed so that the dialog stays
|
||||
lePassword->setEnabled(false); |
||||
return; |
||||
} |
||||
|
||||
void AuthDialog::setRequest(const QString &request, bool requiresAdmin) |
||||
{ |
||||
kDebug() << request; |
||||
PolkitQt1::Identity identity = adminUserSelected(); |
||||
if (request.startsWith(QLatin1String("password:"), Qt::CaseInsensitive)) { |
||||
if (requiresAdmin) { |
||||
if (!identity.isValid()) { |
||||
lblPassword->setText(i18n("Password for root:")); |
||||
} else { |
||||
lblPassword->setText(i18n("Password for %1:", |
||||
identity.toString().remove("unix-user:"))); |
||||
} |
||||
} else { |
||||
lblPassword->setText(i18n("Password:")); |
||||
} |
||||
} else if (request.startsWith(QLatin1String("password or swipe finger:"), |
||||
Qt::CaseInsensitive)) { |
||||
if (requiresAdmin) { |
||||
if (!identity.isValid()) { |
||||
lblPassword->setText(i18n("Password or swipe finger for root:")); |
||||
} else { |
||||
lblPassword->setText(i18n("Password or swipe finger for %1:", |
||||
identity.toString().remove("unix-user:"))); |
||||
} |
||||
} else { |
||||
lblPassword->setText(i18n("Password or swipe finger:")); |
||||
} |
||||
} else { |
||||
lblPassword->setText(request); |
||||
} |
||||
|
||||
} |
||||
|
||||
void AuthDialog::setOptions() |
||||
{ |
||||
lblContent->setText(i18n("An application is attempting to perform an action that requires privileges." |
||||
" Authentication is required to perform this action.")); |
||||
} |
||||
|
||||
void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities) |
||||
{ |
||||
/* if we've already built the list of admin users once, then avoid
|
||||
* doing it again.. (this is mainly used when the user entered the |
||||
* wrong password and the dialog is recycled) |
||||
*/ |
||||
if (identities.count() && (userCB->count() - 1) != identities.count()) { |
||||
// Clears the combobox in the case some user be added
|
||||
userCB->clear(); |
||||
|
||||
// Adds a Dummy user
|
||||
userCB->addItem(i18n("Select User"), qVariantFromValue<QString> (QString())); |
||||
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(); |
||||
const KUser user(identity.toString().remove("unix-user:")); |
||||
if (!user.isValid()) { |
||||
kWarning() << "User invalid: " << user.loginName(); |
||||
continue; |
||||
} |
||||
|
||||
// Display user Full Name IF available
|
||||
QString display; |
||||
if (!user.property(KUser::FullName).toString().isEmpty()) { |
||||
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(); |
||||
} |
||||
|
||||
KIcon icon; |
||||
// load user icon face
|
||||
if (!user.faceIconPath().isEmpty()) { |
||||
icon = KIcon(user.faceIconPath()); |
||||
} else { |
||||
icon = KIcon("user-identity"); |
||||
} |
||||
// 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(); |
||||
} |
||||
} |
||||
|
||||
PolkitQt1::Identity AuthDialog::adminUserSelected() const |
||||
{ |
||||
if (userCB->currentIndex() == -1) |
||||
return PolkitQt1::Identity(); |
||||
|
||||
QString id = userCB->itemData(userCB->currentIndex()).toString(); |
||||
if (id.isEmpty()) |
||||
return PolkitQt1::Identity(); |
||||
return PolkitQt1::Identity::fromString(id); |
||||
} |
||||
|
||||
void AuthDialog::on_userCB_currentIndexChanged(int /*index*/) |
||||
{ |
||||
PolkitQt1::Identity identity = adminUserSelected(); |
||||
// itemData is Null when "Select user" is selected
|
||||
if (!identity.isValid()) { |
||||
lePassword->setEnabled(false); |
||||
lblPassword->setEnabled(false); |
||||
enableButtonOk(false); |
||||
} else { |
||||
lePassword->setEnabled(true); |
||||
lblPassword->setEnabled(true); |
||||
enableButtonOk(true); |
||||
// We need this to restart the auth with the new user
|
||||
emit adminUserSelected(identity); |
||||
// git password label focus
|
||||
lePassword->setFocus(); |
||||
} |
||||
} |
||||
|
||||
QString AuthDialog::password() const |
||||
{ |
||||
return lePassword->text(); |
||||
} |
||||
|
||||
void AuthDialog::authenticationFailure() |
||||
{ |
||||
errorMessageKTW->setText(i18n("Authentication failure, please try again."), KTitleWidget::ErrorMessage); |
||||
QFont bold = font(); |
||||
bold.setBold(true); |
||||
lblPassword->setFont(bold); |
||||
lePassword->setEnabled(true); |
||||
lePassword->clear(); |
||||
lePassword->setFocus(); |
||||
} |
||||
|
||||
void AuthDialog::showEvent(QShowEvent *event) |
||||
{ |
||||
KDialog::showEvent(event); |
||||
if (winId() != KWindowSystem::activeWindow()) |
||||
{ |
||||
KNotification *notification = new KNotification("authenticate", this, |
||||
KNotification::Persistent | KNotification::CloseWhenWidgetActivated); |
||||
kDebug() << "Notificate: " << notification->eventId(); |
||||
notification->setText(m_message); |
||||
QPixmap icon = KIconLoader::global()->loadIcon("dialog-password", |
||||
KIconLoader::NoGroup, |
||||
KIconLoader::SizeHuge, |
||||
KIconLoader::DefaultState); |
||||
notification->setPixmap(icon); |
||||
notification->setActions(QStringList() << i18n("Switch to dialog") << i18n("Cancel")); |
||||
|
||||
connect(notification, SIGNAL(activated(uint)), this, SLOT(notificationActivated(uint))); |
||||
notification->sendEvent(); |
||||
} |
||||
|
||||
} |
||||
|
||||
void AuthDialog::notificationActivated(unsigned int action) |
||||
{ |
||||
kDebug() << "notificationActivated: " << action; |
||||
if (action == 1) |
||||
{ |
||||
KWindowSystem::forceActiveWindow(winId()); |
||||
} |
||||
} |
||||
|
||||
AuthDetails::AuthDetails(const PolkitQt1::Details &details, |
||||
const PolkitQt1::ActionDescription &actionDescription, |
||||
const QString &appname, |
||||
QWidget *parent) |
||||
: QWidget(parent) |
||||
{ |
||||
setupUi(this); |
||||
|
||||
app_label->setText(appname); |
||||
|
||||
foreach(const QString &key, details.keys()) { //krazy:exclude=foreach (Details is not a map/hash, but rather a method)
|
||||
int row = gridLayout->rowCount() + 1; |
||||
|
||||
QLabel *keyLabel = new QLabel(this); |
||||
keyLabel->setText(i18nc("%1 is the name of a detail about the current action " |
||||
"provided by polkit", "%1:", key)); |
||||
gridLayout->addWidget(keyLabel, row, 0); |
||||
|
||||
QLabel *valueLabel = new QLabel(this); |
||||
valueLabel->setText(details.lookup(key)); |
||||
gridLayout->addWidget(valueLabel, row, 1); |
||||
} |
||||
|
||||
action_label->setText(actionDescription.description()); |
||||
|
||||
action_label->setTipText(i18n("Click to edit %1", actionDescription.actionId())); |
||||
action_label->setUrl(actionDescription.actionId()); |
||||
|
||||
QString vendor = actionDescription.vendorName(); |
||||
QString vendorUrl = actionDescription.vendorUrl(); |
||||
|
||||
if (!vendor.isEmpty()) { |
||||
vendorUL->setText(vendor); |
||||
vendorUL->setTipText(i18n("Click to open %1", vendorUrl)); |
||||
vendorUL->setUrl(vendorUrl); |
||||
} else if (!vendorUrl.isEmpty()) { |
||||
vendorUL->setText(vendorUrl); |
||||
vendorUL->setTipText(i18n("Click to open %1", vendorUrl)); |
||||
vendorUL->setUrl(vendorUrl); |
||||
} else { |
||||
vendorL->hide(); |
||||
vendorUL->hide(); |
||||
} |
||||
|
||||
connect(vendorUL, SIGNAL(leftClickedUrl(QString)), SLOT(openUrl(QString))); |
||||
connect(action_label, SIGNAL(leftClickedUrl(QString)), SLOT(openAction(QString))); |
||||
} |
||||
|
||||
void AuthDetails::openUrl(const QString& url) |
||||
{ |
||||
KToolInvocation::invokeBrowser(url); |
||||
} |
||||
|
||||
void AuthDetails::openAction(const QString &url) |
||||
{ |
||||
QProcess::startDetached("polkit-kde-authorization", QStringList() << url); |
||||
} |
||||
|
||||
#include "AuthDialog.moc" |
@ -0,0 +1,90 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007-2008 Gรถkรงen Eraslan <gokcen@pardus.org.tr> |
||||
Copyright (C) 2008 Daniel Nicoletti <dantti85-pk@yahoo.com.br> |
||||
Copyright (C) 2010 Dario Freddi <drf@kde.org> |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public |
||||
License as published by the Free Software Foundation; either |
||||
version 2 of the License, or (at your option) any later version. |
||||
|
||||
This library is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
Library General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Library General Public License |
||||
along with this library; see the file COPYING.LIB. If not, write to |
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
||||
Boston, MA 02110-1301, USA. |
||||
|
||||
*/ |
||||
|
||||
#ifndef AUTHDIALOG_H |
||||
#define AUTHDIALOG_H |
||||
|
||||
#include "ui_AuthDialog.h" |
||||
#include "ui_authdetails.h" |
||||
|
||||
#include <PolkitQt1/Identity> |
||||
#include <PolkitQt1/ActionDescription> |
||||
|
||||
namespace PolkitQt1 |
||||
{ |
||||
class Details; |
||||
} |
||||
|
||||
class AuthDialog : public KDialog, private Ui::AuthDialog |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
AuthDialog(const QString &actionId, |
||||
const QString &message, |
||||
const QString &iconName, |
||||
const PolkitQt1::Details &details, |
||||
const PolkitQt1::Identity::List &identities, |
||||
WId parent); |
||||
~AuthDialog(); |
||||
|
||||
void setRequest(const QString &request, bool requiresAdmin); |
||||
void setOptions(); |
||||
QString password() const; |
||||
void authenticationFailure(); |
||||
|
||||
PolkitQt1::Identity adminUserSelected() const; |
||||
|
||||
PolkitQt1::ActionDescription m_actionDescription; |
||||
|
||||
signals: |
||||
void adminUserSelected(PolkitQt1::Identity); |
||||
|
||||
public slots: |
||||
virtual void accept(); |
||||
|
||||
private slots: |
||||
void on_userCB_currentIndexChanged(int index); |
||||
void notificationActivated(unsigned int action); |
||||
|
||||
private: |
||||
QString m_appname; |
||||
QString m_message; |
||||
|
||||
void createUserCB(const PolkitQt1::Identity::List &identities); |
||||
void showEvent(QShowEvent *); |
||||
}; |
||||
|
||||
class AuthDetails : public QWidget, private Ui::AuthDetails |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
AuthDetails(const PolkitQt1::Details &details, |
||||
const PolkitQt1::ActionDescription &actionDescription, |
||||
const QString &appname, |
||||
QWidget *parent); |
||||
|
||||
private slots: |
||||
void openUrl(const QString&); |
||||
void openAction(const QString&); |
||||
}; |
||||
|
||||
#endif // AUTHDIALOG_H
|
@ -0,0 +1,171 @@
|
||||
<ui version="4.0" > |
||||
<class>AuthDialog</class> |
||||
<widget class="QWidget" name="AuthDialog" > |
||||
<property name="geometry" > |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>335</width> |
||||
<height>193</height> |
||||
</rect> |
||||
</property> |
||||
<property name="sizePolicy" > |
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<layout class="QGridLayout" name="gridLayout" > |
||||
<item rowspan="6" row="0" column="0" > |
||||
<layout class="QVBoxLayout" name="verticalLayout" > |
||||
<item> |
||||
<widget class="QLabel" name="lblPixmap" > |
||||
<property name="sizePolicy" > |
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" > |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="text" > |
||||
<string notr="true">Lock Icon here</string> |
||||
</property> |
||||
<property name="wordWrap" > |
||||
<bool>false</bool> |
||||
</property> |
||||
<property name="buddy" > |
||||
<cstring>lePassword</cstring> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<spacer name="verticalSpacer" > |
||||
<property name="orientation" > |
||||
<enum>Qt::Vertical</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0" > |
||||
<size> |
||||
<width>20</width> |
||||
<height>92</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item row="0" column="1" colspan="3" > |
||||
<layout class="QVBoxLayout" name="verticalLayout_2" > |
||||
<item> |
||||
<widget class="QLabel" name="lblHeader" > |
||||
<property name="sizePolicy" > |
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="text" > |
||||
<string notr="true"><b>Header is here!</b></string> |
||||
</property> |
||||
<property name="wordWrap" > |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="buddy" > |
||||
<cstring>lePassword</cstring> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QLabel" name="lblContent" > |
||||
<property name="sizePolicy" > |
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<property name="text" > |
||||
<string notr="true"><i>Content</i></string> |
||||
</property> |
||||
<property name="wordWrap" > |
||||
<bool>true</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item row="2" column="1" colspan="3" > |
||||
<widget class="KTitleWidget" name="errorMessageKTW" /> |
||||
</item> |
||||
<item row="3" column="1" colspan="2" > |
||||
<widget class="QLabel" name="lblPassword" > |
||||
<property name="text" > |
||||
<string>Password:</string> |
||||
</property> |
||||
<property name="buddy" > |
||||
<cstring>lePassword</cstring> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="3" > |
||||
<widget class="KLineEdit" name="lePassword" > |
||||
<property name="echoMode" > |
||||
<enum>QLineEdit::Password</enum> |
||||
</property> |
||||
<property name="passwordMode" > |
||||
<bool>true</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="1" colspan="3" > |
||||
<widget class="KComboBox" name="userCB" /> |
||||
</item> |
||||
</layout> |
||||
<zorder>errorMessageKTW</zorder> |
||||
<zorder>lblPassword</zorder> |
||||
<zorder>lePassword</zorder> |
||||
<zorder>cbRemember</zorder> |
||||
<zorder>cbSessionOnly</zorder> |
||||
<zorder>horizontalSpacer</zorder> |
||||
<zorder>userCB</zorder> |
||||
</widget> |
||||
<customwidgets> |
||||
<customwidget> |
||||
<class>KComboBox</class> |
||||
<extends>QComboBox</extends> |
||||
<header>kcombobox.h</header> |
||||
</customwidget> |
||||
<customwidget> |
||||
<class>KLineEdit</class> |
||||
<extends>QLineEdit</extends> |
||||
<header>klineedit.h</header> |
||||
</customwidget> |
||||
<customwidget> |
||||
<class>KTitleWidget</class> |
||||
<extends>QWidget</extends> |
||||
<header>ktitlewidget.h</header> |
||||
</customwidget> |
||||
</customwidgets> |
||||
<tabstops> |
||||
<tabstop>userCB</tabstop> |
||||
<tabstop>lePassword</tabstop> |
||||
<tabstop>cbRemember</tabstop> |
||||
<tabstop>cbSessionOnly</tabstop> |
||||
</tabstops> |
||||
<resources/> |
||||
<connections> |
||||
<connection> |
||||
<sender>cbRemember</sender> |
||||
<signal>toggled(bool)</signal> |
||||
<receiver>cbSessionOnly</receiver> |
||||
<slot>setEnabled(bool)</slot> |
||||
<hints> |
||||
<hint type="sourcelabel" > |
||||
<x>259</x> |
||||
<y>161</y> |
||||
</hint> |
||||
<hint type="destinationlabel" > |
||||
<x>161</x> |
||||
<y>169</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
</connections> |
||||
</ui> |
@ -0,0 +1,42 @@
|
||||
project(polkit-kde-agent-1) |
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") |
||||
|
||||
find_package(KDE4 REQUIRED) |
||||
|
||||
set(POLKITQT-1_MIN_VERSION "0.99.0") |
||||
find_package(PolkitQt-1 REQUIRED) |
||||
|
||||
include_directories(${KDE4_INCLUDES} |
||||
${POLKITQT-1_INCLUDE_DIR} |
||||
${CMAKE_CURRENT_SOURCE_DIR} |
||||
${CMAKE_CURRENT_BINARY_DIR}) |
||||
|
||||
set(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}) |
||||
|
||||
target_link_libraries(polkit-kde-authentication-agent-1 |
||||
${KDE4_KDEUI_LIBS} |
||||
${POLKITQT-1_LIBRARIES} |
||||
) |
||||
|
||||
configure_file(polkit-kde-authentication-agent-1.desktop.in ${CMAKE_BINARY_DIR}/polkit-kde-authentication-agent-1.desktop) |
||||
|
||||
install(TARGETS polkit-kde-authentication-agent-1 DESTINATION ${LIBEXEC_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) |
||||
|
||||
include(MacroOptionalAddSubdirectory) |
||||
macro_optional_add_subdirectory( po ) |
@ -0,0 +1,4 @@
|
||||
#! /bin/sh |
||||
$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11 |
||||
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/polkit-kde-authentication-agent-1.pot |
||||
rm -f rc.cpp |
@ -0,0 +1,5 @@
|
||||
Polkit-agent |
||||
============ |
||||
|
||||
Polkit-agent provides a D-Bus session bus service polkit authentication agent |
||||
based on TDE components. |
@ -0,0 +1,91 @@
|
||||
<ui version="4.0" > |
||||
<class>AuthDetails</class> |
||||
<widget class="QWidget" name="AuthDetails" > |
||||
<property name="geometry" > |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>273</width> |
||||
<height>80</height> |
||||
</rect> |
||||
</property> |
||||
<property name="sizePolicy" > |
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" > |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
<layout class="QGridLayout" name="gridLayout" > |
||||
<item row="1" column="0" > |
||||
<widget class="QLabel" name="label" > |
||||
<property name="text" > |
||||
<string>Application:</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="2" column="0" > |
||||
<widget class="QLabel" name="label_3" > |
||||
<property name="text" > |
||||
<string>Action:</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="0" > |
||||
<widget class="QLabel" name="vendorL" > |
||||
<property name="text" > |
||||
<string>Vendor:</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="1" colspan="3" > |
||||
<widget class="KUrlLabel" name="vendorUL" > |
||||
<property name="text" > |
||||
<string>Vendor:</string> |
||||
</property> |
||||
<property name="tipText" > |
||||
<string/> |
||||
</property> |
||||
<property name="useTips" > |
||||
<bool>true</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="2" column="1" colspan="3" > |
||||
<widget class="KUrlLabel" name="action_label" > |
||||
<property name="text" > |
||||
<string>Action:</string> |
||||
</property> |
||||
<property name="tipText" > |
||||
<string/> |
||||
</property> |
||||
<property name="useTips" > |
||||
<bool>true</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="0" column="0" colspan="4" > |
||||
<widget class="Line" name="line" > |
||||
<property name="orientation" > |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="1" colspan="3" > |
||||
<widget class="QLabel" name="app_label" > |
||||
<property name="text" > |
||||
<string>Application:</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<customwidgets> |
||||
<customwidget> |
||||
<class>KUrlLabel</class> |
||||
<extends>QLabel</extends> |
||||
<header>kurllabel.h</header> |
||||
</customwidget> |
||||
</customwidgets> |
||||
<resources/> |
||||
<connections/> |
||||
</ui> |
@ -0,0 +1,60 @@
|
||||
polkit-kde-1 (0.99.1-1) unstable; urgency=low |
||||
|
||||
* Team upload. |
||||
|
||||
[ Felix Geyer ] |
||||
* New upstream release. |
||||
- Drop fix_dialog_focus.diff, applied upstream. |
||||
- Remove non-functional checkbox "Remember password". (Closes: #691104) |
||||
* Remove obsolete /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop |
||||
on upgrade. (Closes: #645440) |
||||
* Bump Standards-Version to 3.9.4, no changes needed. |
||||
|
||||
[ Pino Toscano ] |
||||
* The rebuild changes the kdebase-runtime dependency to kde-runtime. |
||||
(Closes: #716849) |
||||
* Update Vcs-* headers |
||||
|
||||
-- Felix Geyer <fgeyer@debian.org> Mon, 12 Aug 2013 11:58:57 +0200 |
||||
|
||||
polkit-kde-1 (0.99.0-3) unstable; urgency=low |
||||
|
||||
[ Scott Kitterman ] |
||||
* Add debian/patches/fix_dialog_focus.diff from Kubuntu |
||||
- Prevents the auth dialog from popping up in the background where it can't |
||||
be seen |
||||
|
||||
-- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Thu, 23 Jun 2011 11:38:30 +0300 |
||||
|
||||
polkit-kde-1 (0.99.0-2) unstable; urgency=low |
||||
|
||||
[ Modestas Vainius ] |
||||
* Bump Standards-Version to 3.9.2: no changes needed. |
||||
|
||||
-- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Thu, 26 May 2011 00:28:45 +0300 |
||||
|
||||
polkit-kde-1 (0.99.0-1) experimental; urgency=low |
||||
|
||||
* New upstream release. |
||||
|
||||
[ Modestas Vainius ] |
||||
* Add Vcs fields to debian/control. |
||||
* Switch to dhmk based debian-qt-kde.mk. |
||||
|
||||
[ Josรฉ Manuel Santamarรญa Lema ] |
||||
* Bump Standards-Version to 3.9.1, no changes needed. |
||||
* Bump libpolkit-qt-1-dev build depend to 0.99.0. |
||||
|
||||
-- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Wed, 23 Mar 2011 01:30:52 +0200 |
||||
|
||||
polkit-kde-1 (0.95.1-2) unstable; urgency=low |
||||
|
||||
* Update debian/control: add policykit-1 dependency. |
||||
|
||||
-- Fathi Boudra <fabo@debian.org> Mon, 22 Mar 2010 09:08:17 +0100 |
||||
|
||||
polkit-kde-1 (0.95.1-1) unstable; urgency=low |
||||
|
||||
* Initial release. (Closes: #571531) |
||||
|
||||
-- Fathi Boudra <fabo@debian.org> Thu, 25 Feb 2010 20:43:18 +0100 |
@ -0,0 +1,24 @@
|
||||
Source: polkit-kde-1 |
||||
Priority: optional |
||||
Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> |
||||
Uploaders: Fathi Boudra <fabo@debian.org> |
||||
Build-Depends: debhelper (>= 7.4.15), cmake, pkg-kde-tools (>= 0.11), |
||||
kdelibs5-dev, libpolkit-qt-1-dev (>= 0.99.0) |
||||
Standards-Version: 3.9.4 |
||||
Section: libs |
||||
Vcs-Git: git://anonscm.debian.org/pkg-kde/kde-req/polkit-kde-1.git |
||||
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-kde/kde-req/polkit-kde-1.git |
||||
|
||||
Package: polkit-kde-1 |
||||
Architecture: any |
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, policykit-1 |
||||
Description: KDE dialogs for PolicyKit |
||||
PolicyKit is an application-level toolkit for defining and handling the policy |
||||
that allows unprivileged processes to speak to privileged processes. |
||||
. |
||||
It is a framework for centralizing the decision making process with respect to |
||||
granting access to privileged operations (like calling the HAL Mount() method) |
||||
for unprivileged (desktop) applications. |
||||
. |
||||
PolicyKit-Kde provides a D-Bus session bus service that is used to |
||||
bring up authentication dialogs used for obtaining privileges. |
@ -0,0 +1,47 @@
|
||||
This work was packaged for Debian by: |
||||
|
||||
Fathi Boudra <fabo@debian.org> on Fri, 15 Jan 2010 12:50:13 +0100 |
||||
|
||||
It was downloaded from ftp://ftp.kde.org/pub/kde/stable/apps/KDE4.x/admin/ |
||||
|
||||
Upstream Authors: |
||||
|
||||
Jaroslav Reznik <jreznik@redhat.com> |
||||
Gรถkรงen Eraslan <gokcen@pardus.org.tr> |
||||
Dario Freddi <drf@kde.org> |
||||
Daniel Nicoletti <dantti85-pk@yahoo.com.br> |
||||
Dirk Mueller <mueller@kde.org> |
||||
|
||||
Copyright: |
||||
|
||||
Copyright (C) 2009 Jaroslav Reznik |
||||
Copyright (C) 2007-2008 Gรถkรงen Eraslan |
||||
Copyright (C) 2008-2009 Dario Freddi |
||||
Copyright (C) 2008 Daniel Nicoletti |
||||
Copyright (C) 2008 Dirk Mueller |
||||
|
||||
License: |
||||
|
||||
This package is free software; you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation; either version 2 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This package is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this package; if not, write to the Free Software |
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
||||
|
||||
On Debian systems, the complete text of the GNU General |
||||
Public License can be found in `/usr/share/common-licenses/GPL-2' and |
||||
`/usr/share/common-licenses/GPL-3'. |
||||
|
||||
The Debian packaging is: |
||||
|
||||
Copyright (C) 2010 Fathi Boudra <fabo@debian.org> |
||||
|
||||
and is licensed under the GPL version 2 or any later version. |
@ -0,0 +1 @@
|
||||
rm_conffile /etc/xdg/autostart/polkit-kde-authentication-agent-1.desktop 0.99.0-4~ |
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/make -f |
||||
|
||||
# Uncomment this to turn on verbose mode. |
||||
#export DH_VERBOSE=1 |
||||
|
||||
include /usr/share/pkg-kde-tools/qt-kde-team/2/debian-qt-kde.mk |
||||
|
||||
.PHONY: override_dh_auto_test |
@ -0,0 +1,48 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com> |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public |
||||
License as published by the Free Software Foundation; either |
||||
version 2 of the License, or (at your option) any later version. |
||||
|
||||
This library is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
Library General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Library General Public License |
||||
along with this library; see the file COPYING.LIB. If not, write to |
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
||||
Boston, MA 02110-1301, USA. |
||||
|
||||
*/ |
||||
|
||||
#include <KCmdLineArgs> |
||||
#include <KAboutData> |
||||
#include <KLocale> |
||||
#include <KCrash> |
||||
|
||||
#include "policykitkde.h" |
||||
|
||||
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, |
||||
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"); |
||||
|
||||
KCmdLineArgs::init(argc, argv, &aboutData); |
||||
|
||||
if (!PolicyKitKDE::start()) { |
||||
qWarning("PolicyKitKDE is already running!\n"); |
||||
return 0; |
||||
} |
||||
|
||||
KCrash::setFlags(KCrash::AutoRestart); |
||||
|
||||
PolicyKitKDE agent; |
||||
agent.disableSessionManagement(); |
||||
agent.exec(); |
||||
} |
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
||||
<node> |
||||
<interface name="org.freedesktop.PolicyKit.AuthenticationAgent"> |
||||
<method name="ObtainAuthorization" > |
||||
<!-- IN: PolicyKit action identifier; see PolKitAction --> |
||||
<arg direction="in" type="s" name="action_id" /> |
||||
<!-- IN: X11 window ID for the top-level X11 window the dialog will be transient for. --> |
||||
<arg direction="in" type="u" name="xid" /> |
||||
<!-- IN: Process ID to grant authorization to --> |
||||
<arg direction="in" type="u" name="pid" /> |
||||
<!-- OUT: whether the user gained the authorization --> |
||||
<arg direction="out" type="b" name="gained_authorization" /> |
||||
</method> |
||||
</interface> |
||||
</node> |
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" |
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> |
||||
<node> |
||||
<interface name="org.kde.Polkit1AuthAgent"> |
||||
<method name="setWIdForAction"> |
||||
<arg type="s" direction="in" /> |
||||
<arg type="t" direction="in" /> |
||||
</method> |
||||
</interface> |
||||
</node> |
@ -0,0 +1,63 @@
|
||||
# The pofiles macro creates in some versions same name targets |
||||
# which since cmake 2.8 leads to target clashes. |
||||
# Hence force the old policy for all po directories. |
||||
# http://public.kitware.com/Bug/view.php?id=12952 |
||||
cmake_policy(SET CMP0002 OLD) |
||||
|
||||
find_package(Gettext REQUIRED) |
||||
if (NOT GETTEXT_MSGMERGE_EXECUTABLE) |
||||
MESSAGE(FATAL_ERROR "Please install msgmerge binary") |
||||
endif (NOT GETTEXT_MSGMERGE_EXECUTABLE) |
||||
if (NOT GETTEXT_MSGFMT_EXECUTABLE) |
||||
MESSAGE(FATAL_ERROR "Please install msgmerge binary") |
||||
endif (NOT GETTEXT_MSGFMT_EXECUTABLE) |
||||
add_subdirectory(zh_TW) |
||||
add_subdirectory(zh_CN) |
||||
add_subdirectory(vi) |
||||
add_subdirectory(uk) |
||||
add_subdirectory(ug) |
||||
add_subdirectory(tr) |
||||
add_subdirectory(th) |
||||
add_subdirectory(sv) |
||||
add_subdirectory(sr@latin) |
||||
add_subdirectory(sr@ijekavianlatin) |
||||
add_subdirectory(sr@ijekavian) |
||||
add_subdirectory(sr) |
||||
add_subdirectory(sl) |
||||
add_subdirectory(sk) |
||||
add_subdirectory(ru) |
||||
add_subdirectory(ro) |
||||
add_subdirectory(pt_BR) |
||||
add_subdirectory(pt) |
||||
add_subdirectory(pl) |
||||
add_subdirectory(pa) |
||||
add_subdirectory(nl) |
||||
add_subdirectory(nds) |
||||
add_subdirectory(nb) |
||||
add_subdirectory(ms) |
||||
add_subdirectory(mr) |
||||
add_subdirectory(mai) |
||||