summaryrefslogtreecommitdiffstats
path: root/src/AuthDialog.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-12-17 19:53:54 +0900
committerMichele Calgaro <[email protected]>2021-12-17 19:53:54 +0900
commit35181c8a0f3b1e381a53b59bb327c477e55c0178 (patch)
tree1c546bbf2c5b44a8319cd4a1a43146ba1a3998e8 /src/AuthDialog.cpp
parent5a3408879dbba9ac96ea027a16a5c67aaf49d855 (diff)
downloadpolkit-agent-tde-35181c8a0f3b1e381a53b59bb327c477e55c0178.tar.gz
polkit-agent-tde-35181c8a0f3b1e381a53b59bb327c477e55c0178.zip
Raw Qt->TQt conversion using tde/scripts/conversions/qt3-tqt3/convert_existing_qt3_app_to_tq
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/AuthDialog.cpp')
-rw-r--r--src/AuthDialog.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/AuthDialog.cpp b/src/AuthDialog.cpp
index f2c4886..7363ae9 100644
--- a/src/AuthDialog.cpp
+++ b/src/AuthDialog.cpp
@@ -23,25 +23,25 @@
#include "AuthDialog.h"
-#include <QtCore/QProcess>
-#include <QtGui/QPainter>
-#include <QtGui/QStandardItemModel>
+#include <TQtCore/TQProcess>
+#include <TQtGui/TQPainter>
+#include <TQtGui/TQStandardItemModel>
#include <KDebug>
#include <KToolInvocation>
#include <KUser>
-#include <PolkitQt1/Authority>
-#include <PolkitQt1/Details>
+#include <PolkitTQt1/Authority>
+#include <PolkitTQt1/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,
+AuthDialog::AuthDialog(const TQString &actionId,
+ const TQString &message,
+ const TQString &iconName,
+ const PolkitTQt1::Details &details,
+ const PolkitTQt1::Identity::List &identities,
WId parent)
: KDialog(0)
{
@@ -71,29 +71,29 @@ AuthDialog::AuthDialog(const QString &actionId,
}
// loads the standard key icon
- QPixmap icon = KIconLoader::global()->loadIcon("dialog-password",
+ TQPixmap 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);
+ TQPainter 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,
+ const TQPixmap pixmap = KIconLoader::global()->loadIcon(iconName,
KIconLoader::NoGroup,
overlaySize,
KIconLoader::DefaultState,
- QStringList(),
+ TQStringList(),
0,
true);
// if we're able to load the action icon paint it over the
// key icon.
if (!pixmap.isNull()) {
- QPoint startPoint;
+ TQPoint startPoint;
// bottom right corner
- startPoint = QPoint(iconSize - overlaySize - 2,
+ startPoint = TQPoint(iconSize - overlaySize - 2,
iconSize - overlaySize - 2);
painter.drawPixmap(startPoint, pixmap);
}
@@ -102,7 +102,7 @@ AuthDialog::AuthDialog(const QString &actionId,
lblPixmap->setPixmap(icon);
// find action description for actionId
- foreach(const PolkitQt1::ActionDescription &desc, PolkitQt1::Authority::instance()->enumerateActionsSync()) {
+ foreach(const PolkitTQt1::ActionDescription &desc, PolkitTQt1::Authority::instance()->enumerateActionsSync()) {
if (actionId == desc.actionId()) {
m_actionDescription = desc;
kDebug() << "Action description has been found" ;
@@ -125,7 +125,7 @@ AuthDialog::AuthDialog(const QString &actionId,
createUserCB(identities);
} else {
- userCB->addItem("", QVariant(identities[0].toString()));
+ userCB->addItem("", TQVariant(identities[0].toString()));
userCB->setCurrentIndex(0);
}
}
@@ -141,11 +141,11 @@ void AuthDialog::accept()
return;
}
-void AuthDialog::setRequest(const QString &request, bool requiresAdmin)
+void AuthDialog::setRequest(const TQString &request, bool requiresAdmin)
{
kDebug() << request;
- PolkitQt1::Identity identity = adminUserSelected();
- if (request.startsWith(QLatin1String("password:"), Qt::CaseInsensitive)) {
+ PolkitTQt1::Identity identity = adminUserSelected();
+ if (request.startsWith(TQLatin1String("password:"), TQt::CaseInsensitive)) {
if (requiresAdmin) {
if (!identity.isValid()) {
lblPassword->setText(i18n("Password for root:"));
@@ -156,8 +156,8 @@ void AuthDialog::setRequest(const QString &request, bool requiresAdmin)
} else {
lblPassword->setText(i18n("Password:"));
}
- } else if (request.startsWith(QLatin1String("password or swipe finger:"),
- Qt::CaseInsensitive)) {
+ } else if (request.startsWith(TQLatin1String("password or swipe finger:"),
+ TQt::CaseInsensitive)) {
if (requiresAdmin) {
if (!identity.isValid()) {
lblPassword->setText(i18n("Password or swipe finger for root:"));
@@ -180,7 +180,7 @@ void AuthDialog::setOptions()
" Authentication is required to perform this action."));
}
-void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
+void AuthDialog::createUserCB(const PolkitTQt1::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
@@ -191,14 +191,14 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
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);
+ userCB->addItem(i18n("Select User"), qVariantFromValue<TQString> (TQString()));
+ qobject_cast<TQStandardItemModel *>(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) {
+ foreach(const PolkitTQt1::Identity &identity, identities) {
// First check to see if the user is valid
kDebug() << "User: " << identity.toString();
const KUser user(identity.toString().remove("unix-user:"));
@@ -208,7 +208,7 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
}
// Display user Full Name IF available
- QString display;
+ TQString 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 {
@@ -223,7 +223,7 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
icon = KIcon("user-identity");
}
// appends the user item
- userCB->addItem(icon, display, qVariantFromValue<QString> (identity.toString()));
+ userCB->addItem(icon, display, qVariantFromValue<TQString> (identity.toString()));
if (user == currentUser) {
currentUserIndex = index;
@@ -239,20 +239,20 @@ void AuthDialog::createUserCB(const PolkitQt1::Identity::List &identities)
}
}
-PolkitQt1::Identity AuthDialog::adminUserSelected() const
+PolkitTQt1::Identity AuthDialog::adminUserSelected() const
{
if (userCB->currentIndex() == -1)
- return PolkitQt1::Identity();
+ return PolkitTQt1::Identity();
- QString id = userCB->itemData(userCB->currentIndex()).toString();
+ TQString id = userCB->itemData(userCB->currentIndex()).toString();
if (id.isEmpty())
- return PolkitQt1::Identity();
- return PolkitQt1::Identity::fromString(id);
+ return PolkitTQt1::Identity();
+ return PolkitTQt1::Identity::fromString(id);
}
void AuthDialog::on_userCB_currentIndexChanged(int /*index*/)
{
- PolkitQt1::Identity identity = adminUserSelected();
+ PolkitTQt1::Identity identity = adminUserSelected();
// itemData is Null when "Select user" is selected
if (!identity.isValid()) {
lePassword->setEnabled(false);
@@ -269,7 +269,7 @@ void AuthDialog::on_userCB_currentIndexChanged(int /*index*/)
}
}
-QString AuthDialog::password() const
+TQString AuthDialog::password() const
{
return lePassword->text();
}
@@ -277,7 +277,7 @@ QString AuthDialog::password() const
void AuthDialog::authenticationFailure()
{
errorMessageKTW->setText(i18n("Authentication failure, please try again."), KTitleWidget::ErrorMessage);
- QFont bold = font();
+ TQFont bold = font();
bold.setBold(true);
lblPassword->setFont(bold);
lePassword->setEnabled(true);
@@ -285,7 +285,7 @@ void AuthDialog::authenticationFailure()
lePassword->setFocus();
}
-void AuthDialog::showEvent(QShowEvent *event)
+void AuthDialog::showEvent(TQShowEvent *event)
{
KDialog::showEvent(event);
if (winId() != KWindowSystem::activeWindow())
@@ -294,12 +294,12 @@ void AuthDialog::showEvent(QShowEvent *event)
KNotification::Persistent | KNotification::CloseWhenWidgetActivated);
kDebug() << "Notificate: " << notification->eventId();
notification->setText(m_message);
- QPixmap icon = KIconLoader::global()->loadIcon("dialog-password",
+ TQPixmap icon = KIconLoader::global()->loadIcon("dialog-password",
KIconLoader::NoGroup,
KIconLoader::SizeHuge,
KIconLoader::DefaultState);
notification->setPixmap(icon);
- notification->setActions(QStringList() << i18n("Switch to dialog") << i18n("Cancel"));
+ notification->setActions(TQStringList() << i18n("Switch to dialog") << i18n("Cancel"));
connect(notification, SIGNAL(activated(uint)), this, SLOT(notificationActivated(uint)));
notification->sendEvent();
@@ -316,25 +316,25 @@ void AuthDialog::notificationActivated(unsigned int action)
}
}
-AuthDetails::AuthDetails(const PolkitQt1::Details &details,
- const PolkitQt1::ActionDescription &actionDescription,
- const QString &appname,
- QWidget *parent)
- : QWidget(parent)
+AuthDetails::AuthDetails(const PolkitTQt1::Details &details,
+ const PolkitTQt1::ActionDescription &actionDescription,
+ const TQString &appname,
+ TQWidget *parent)
+ : TQWidget(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)
+ foreach(const TQString &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);
+ TQLabel *keyLabel = new TQLabel(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);
+ TQLabel *valueLabel = new TQLabel(this);
valueLabel->setText(details.lookup(key));
gridLayout->addWidget(valueLabel, row, 1);
}
@@ -344,8 +344,8 @@ AuthDetails::AuthDetails(const PolkitQt1::Details &details,
action_label->setTipText(i18n("Click to edit %1", actionDescription.actionId()));
action_label->setUrl(actionDescription.actionId());
- QString vendor = actionDescription.vendorName();
- QString vendorUrl = actionDescription.vendorUrl();
+ TQString vendor = actionDescription.vendorName();
+ TQString vendorUrl = actionDescription.vendorUrl();
if (!vendor.isEmpty()) {
vendorUL->setText(vendor);
@@ -360,18 +360,18 @@ AuthDetails::AuthDetails(const PolkitQt1::Details &details,
vendorUL->hide();
}
- connect(vendorUL, SIGNAL(leftClickedUrl(QString)), SLOT(openUrl(QString)));
- connect(action_label, SIGNAL(leftClickedUrl(QString)), SLOT(openAction(QString)));
+ connect(vendorUL, SIGNAL(leftClickedUrl(TQString)), SLOT(openUrl(TQString)));
+ connect(action_label, SIGNAL(leftClickedUrl(TQString)), SLOT(openAction(TQString)));
}
-void AuthDetails::openUrl(const QString& url)
+void AuthDetails::openUrl(const TQString& url)
{
KToolInvocation::invokeBrowser(url);
}
-void AuthDetails::openAction(const QString &url)
+void AuthDetails::openAction(const TQString &url)
{
- QProcess::startDetached("polkit-kde-authorization", QStringList() << url);
+ TQProcess::startDetached("polkit-kde-authorization", TQStringList() << url);
}
#include "AuthDialog.moc"