diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/PkExample.cpp | 114 | ||||
-rw-r--r-- | examples/PkExample.h | 4 | ||||
-rw-r--r-- | examples/PkExample.ui | 52 | ||||
-rw-r--r-- | examples/PkExampleHelper.cpp | 54 | ||||
-rw-r--r-- | examples/PkExampleHelper.h | 12 | ||||
-rw-r--r-- | examples/agent/klistener.cpp | 58 | ||||
-rw-r--r-- | examples/agent/klistener.h | 30 | ||||
-rw-r--r-- | examples/agent/main.cpp | 2 | ||||
-rw-r--r-- | examples/agent/pkagentexample.cpp | 6 | ||||
-rw-r--r-- | examples/agent/pkagentexample.h | 6 | ||||
-rw-r--r-- | examples/main.cpp | 4 |
11 files changed, 171 insertions, 171 deletions
diff --git a/examples/PkExample.cpp b/examples/PkExample.cpp index 2168a9117..5c0e57d22 100644 --- a/examples/PkExample.cpp +++ b/examples/PkExample.cpp @@ -24,29 +24,29 @@ #include "gui/polkitqt1-gui-actionbutton.h" #include "gui/polkitqt1-gui-actionbuttons.h" #include "core/polkitqt1-authority.h" -#include <QtCore/QDebug> +#include <TQtCore/TQDebug> -#include <QtDBus/QDBusMessage> -#include <QtDBus/QDBusConnection> +#include <TQtDBus/TQDBusMessage> +#include <TQtDBus/TQDBusConnection> -using namespace PolkitQt1; -using namespace PolkitQt1::Gui; +using namespace PolkitTQt1; +using namespace PolkitTQt1::Gui; -PkExample::PkExample(QMainWindow *parent) - : QMainWindow(parent) +PkExample::PkExample(TQMainWindow *parent) + : TQMainWindow(parent) { setupUi(this); ActionButton *bt; // Here we create an ActionButton that is a subclass of Action - // always pass a QAbstractButton pointer and action id + // always pass a TQAbstractButton pointer and action id // You can change the action id later if you want bt = new ActionButton(kickPB, "org.qt.policykit.examples.kick", this); // Here we are setting the text and icon to all four states // an action might have bt->setText("Kick!"); - bt->setIcon(QPixmap(":/Icons/custom-no.png")); + bt->setIcon(TQPixmap(":/Icons/custom-no.png")); // By using set{Yes|No|Auth}Enabled you can set the states // when the button is enabled bt->setEnabled(true, Action::No); @@ -54,32 +54,32 @@ PkExample::PkExample(QMainWindow *parent) menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); // this signal is emitted when the user click on the action, - // it will only happen if it was inserted in a QMenu or a QToolBar + // it will only happen if it was inserted in a TQMenu or a TQToolBar connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - // This signal was propagated from the QAbstractButton just for + // This signal was propagated from the TQAbstractButton just for // convenience in this case we don't have any benefit but the code // look cleaner - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); // this is the Action activated signal, it is always emmited whenever // someone click and get authorized to do the action connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); bt = new ActionButton(cryPB, "org.qt.policykit.examples.cry", this); bt->setText("Cry!"); - bt->setIcon(QPixmap(":/Icons/custom-yes.png")); + bt->setIcon(TQPixmap(":/Icons/custom-yes.png")); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); bt = new ActionButton(bleedPB, "org.qt.policykit.examples.bleed", this); bt->setText("Bleed!"); - bt->setIcon(QPixmap(":/Icons/action-locked-default.png")); + bt->setIcon(TQPixmap(":/Icons/action-locked-default.png")); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); // This action is more customized @@ -89,67 +89,67 @@ PkExample::PkExample(QMainWindow *parent) bt->setEnabled(true, Action::No | Action::Auth | Action::Yes); // here we set the behavior of PolKitResul = No bt->setText("Can't play!", Action::No); - bt->setIcon(QPixmap(":/Icons/custom-no.png"), Action::No); + bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No); bt->setToolTip("If your admin wasn't annoying, you could do this", Action::No); // here we set the behavior of PolKitResul = Auth bt->setText("Play?", Action::Auth); - bt->setIcon(QPixmap(":/Icons/action-locked-default.png"), Action::Auth); + bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth); bt->setToolTip("Only card carrying tweakers can do this!", Action::Auth); // here we set the behavior of PolKitResul = Yes bt->setText("Play!", Action::Yes); - bt->setIcon(QPixmap(":/Icons/custom-yes.png"), Action::Yes); + bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes); bt->setToolTip("Go ahead, play!", Action::Yes); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); bt = new ActionButton(deletePB, "org.qt.policykit.examples.delete", this); bt->setText("Delete!"); - bt->setIcon(QPixmap(":/Icons/custom-no.png"), Action::No); - bt->setIcon(QPixmap(":/Icons/action-locked-default.png"), Action::Auth); - bt->setIcon(QPixmap(":/Icons/custom-yes.png"), Action::Yes); + bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No); + bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth); + bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); bt = new ActionButton(listenPB, "org.qt.policykit.examples.listen", this); bt->setText("Listen!"); - bt->setIcon(QPixmap(":/Icons/custom-no.png"), Action::No); - bt->setIcon(QPixmap(":/Icons/action-locked-default.png"), Action::Auth); - bt->setIcon(QPixmap(":/Icons/custom-yes.png"), Action::Yes); + bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No); + bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth); + bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); bt = new ActionButton(setPB, "org.qt.policykit.examples.set", this); bt->setText("Set!"); - bt->setIcon(QPixmap(":/Icons/custom-no.png"), Action::No); - bt->setIcon(QPixmap(":/Icons/action-locked-default.png"), Action::Auth); - bt->setIcon(QPixmap(":/Icons/custom-yes.png"), Action::Yes); + bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No); + bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth); + bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); bt = new ActionButton(shoutPB, "org.qt.policykit.examples.shout", this); - bt->setIcon(QPixmap(":/Icons/custom-no.png"), Action::No); - bt->setIcon(QPixmap(":/Icons/action-locked-default.png"), Action::Auth); - bt->setIcon(QPixmap(":/Icons/custom-yes.png"), Action::Yes); + bt->setIcon(TQPixmap(":/Icons/custom-no.png"), Action::No); + bt->setIcon(TQPixmap(":/Icons/action-locked-default.png"), Action::Auth); + bt->setIcon(TQPixmap(":/Icons/custom-yes.png"), Action::Yes); bt->setText("Can't shout!", Action::No); bt->setText("Shout?", Action::Auth); bt->setText("Shout!", Action::Yes); menuActions->addAction(qobject_cast<Action *>(bt)); toolBar->addAction(qobject_cast<Action *>(bt)); connect(bt, SIGNAL(triggered(bool)), this, SLOT(activateAction())); - connect(bt, SIGNAL(clicked(QAbstractButton *, bool)), bt, SLOT(activate())); + connect(bt, SIGNAL(clicked(TQAbstractButton *, bool)), bt, SLOT(activate())); connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); // test configChanged @@ -183,33 +183,33 @@ void PkExample::actionActivated() // this is our Special Action that after allowed will call the helper if (action->is("org.qt.policykit.examples.set")) { - qDebug() << "toggled for: org.qt.policykit.examples.set"; + tqDebug() << "toggled for: org.qt.policykit.examples.set"; - QDBusMessage message; - message = QDBusMessage::createMethodCall("org.qt.policykit.examples", + TQDBusMessage message; + message = TQDBusMessage::createMethodCall("org.qt.policykit.examples", "/", "org.qt.policykit.examples", - QLatin1String("set")); - QList<QVariant> argumentList; + TQLatin1String("set")); + TQList<TQVariant> argumentList; argumentList << qVariantFromValue(setCB->currentText()); message.setArguments(argumentList); // notice the systemBus here.. - QDBusMessage reply = QDBusConnection::systemBus().call(message); - if (reply.type() == QDBusMessage::ReplyMessage + TQDBusMessage reply = TQDBusConnection::systemBus().call(message); + if (reply.type() == TQDBusMessage::ReplyMessage && reply.arguments().size() == 1) { // the reply can be anything, here we receive a bool - QListWidgetItem *item; + TQListWidgetItem *item; if (reply.arguments().first().toBool()) - item = new QListWidgetItem(QPixmap(":/Icons/custom-yes.png"), - QString("Implicit authorization for shout has been set to %0") + item = new TQListWidgetItem(TQPixmap(":/Icons/custom-yes.png"), + TQString("Implicit authorization for shout has been set to %0") .arg(setCB->currentText())); else - item = new QListWidgetItem(QPixmap(":/Icons/custom-no.png"), - QString("Can't change the implicit authorization. Denied.")); + item = new TQListWidgetItem(TQPixmap(":/Icons/custom-no.png"), + TQString("Can't change the implicit authorization. Denied.")); actionList->addItem(item); - qDebug() << reply.arguments().first().toString(); - } else if (reply.type() == QDBusMessage::MethodCallMessage) { - qWarning() << "Message did not receive a reply (timeout by message bus)"; + tqDebug() << reply.arguments().first().toString(); + } else if (reply.type() == TQDBusMessage::MethodCallMessage) { + tqWarning() << "Message did not receive a reply (timeout by message bus)"; } return; } @@ -219,22 +219,22 @@ void PkExample::actionActivated() // will run as root (setuid is not needed, see DBus docs). // In the helper application you will issue checkAuthorizationSync, // passing the action id and the caller pid (which DBus will tell you). - qDebug() << "pretending to be the mechanism for action:" << action->actionId(); + tqDebug() << "pretending to be the mechanism for action:" << action->actionId(); Authority::Result result; - UnixProcessSubject subject(static_cast<uint>(QCoreApplication::applicationPid())); + UnixProcessSubject subject(static_cast<uint>(TQCoreApplication::applicationPid())); result = Authority::instance()->checkAuthorizationSync(action->actionId(), subject, Authority::AllowUserInteraction); if (result == Authority::Yes) { // in the helper you will do the action - qDebug() << "caller is authorized to do:" << action->actionId(); - QListWidgetItem *item = new QListWidgetItem(QPixmap(":/Icons/custom-yes.png"), action->actionId()); + tqDebug() << "caller is authorized to do:" << action->actionId(); + TQListWidgetItem *item = new TQListWidgetItem(TQPixmap(":/Icons/custom-yes.png"), action->actionId()); actionList->addItem(item); } else { // OR return false to notify the caller that the action is not authorized. - qDebug() << "caller is NOT authorized to do:" << action->actionId(); - QListWidgetItem *item = new QListWidgetItem(QIcon(":/Icons/custom-no.png"), action->actionId()); + tqDebug() << "caller is NOT authorized to do:" << action->actionId(); + TQListWidgetItem *item = new TQListWidgetItem(TQIcon(":/Icons/custom-no.png"), action->actionId()); actionList->addItem(item); } } diff --git a/examples/PkExample.h b/examples/PkExample.h index 4ede9f630..30958821b 100644 --- a/examples/PkExample.h +++ b/examples/PkExample.h @@ -24,12 +24,12 @@ #include "ui_PkExample.h" -class PkExample : public QMainWindow, Ui::PkExample +class PkExample : public TQMainWindow, Ui::PkExample { Q_OBJECT public: - PkExample(QMainWindow *parent = 0); + PkExample(TQMainWindow *parent = 0); ~PkExample(); private Q_SLOTS: diff --git a/examples/PkExample.ui b/examples/PkExample.ui index 8997e506a..8b49cf205 100644 --- a/examples/PkExample.ui +++ b/examples/PkExample.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>PkExample</class> - <widget class="QMainWindow" name="PkExample"> + <widget class="TQMainWindow" name="PkExample"> <property name="geometry"> <rect> <x>0</x> @@ -13,12 +13,12 @@ <property name="windowTitle"> <string>PolicyKit-qt example</string> </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QHBoxLayout" name="horizontalLayout"> + <widget class="TQWidget" name="centralwidget"> + <layout class="TQHBoxLayout" name="horizontalLayout"> <item> - <layout class="QGridLayout" name="gridLayout" columnstretch="3,1"> + <layout class="TQGridLayout" name="gridLayout" columnstretch="3,1"> <item row="0" column="0"> - <widget class="QLabel" name="kickL"> + <widget class="TQLabel" name="kickL"> <property name="text"> <string>Making the helper <b>Kick</b> is not allowed. Action cannot be triggered.</string> </property> @@ -28,14 +28,14 @@ </widget> </item> <item row="0" column="1"> - <widget class="QPushButton" name="kickPB"> + <widget class="TQPushButton" name="kickPB"> <property name="text"> <string>Kick!</string> </property> </widget> </item> <item row="1" column="0"> - <widget class="QLabel" name="cryL"> + <widget class="TQLabel" name="cryL"> <property name="text"> <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -49,14 +49,14 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="1" column="1"> - <widget class="QPushButton" name="cryPB"> + <widget class="TQPushButton" name="cryPB"> <property name="text"> <string>Cry!</string> </property> </widget> </item> <item row="2" column="0"> - <widget class="QLabel" name="bleedL"> + <widget class="TQLabel" name="bleedL"> <property name="text"> <string>Making the helper <b>Bleed</b> requires the user to authenticate. This is a one-shot authorization.</string> </property> @@ -66,14 +66,14 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="2" column="1"> - <widget class="QPushButton" name="bleedPB"> + <widget class="TQPushButton" name="bleedPB"> <property name="text"> <string>Bleed!</string> </property> </widget> </item> <item row="3" column="0"> - <widget class="QLabel" name="playL"> + <widget class="TQLabel" name="playL"> <property name="text"> <string>Making the helper <b>Play</b> requires a system administrator to authenticate. This is a one-shot authorization.</string> </property> @@ -83,14 +83,14 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="3" column="1"> - <widget class="QPushButton" name="playPB"> + <widget class="TQPushButton" name="playPB"> <property name="text"> <string>Play!</string> </property> </widget> </item> <item row="4" column="0"> - <widget class="QLabel" name="listenL"> + <widget class="TQLabel" name="listenL"> <property name="text"> <string>Making the helper <b>Listen</b> requires the user to authenticate. The authorization will be kept for a brief period.</string> </property> @@ -100,14 +100,14 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="4" column="1"> - <widget class="QPushButton" name="listenPB"> + <widget class="TQPushButton" name="listenPB"> <property name="text"> <string>Listen!</string> </property> </widget> </item> <item row="5" column="0"> - <widget class="QLabel" name="deleteL"> + <widget class="TQLabel" name="deleteL"> <property name="text"> <string>Making the helper <b>Delete</b> requires a system administrator to authenticate. The authorization will be kept for a brief period.</string> </property> @@ -117,14 +117,14 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="5" column="1"> - <widget class="QPushButton" name="deletePB"> + <widget class="TQPushButton" name="deletePB"> <property name="text"> <string>Delete!</string> </property> </widget> </item> <item row="6" column="0" rowspan="2"> - <widget class="QLabel" name="deleteL_2"> + <widget class="TQLabel" name="deleteL_2"> <property name="text"> <string><b>Set</b> is special action. It sets the permissions for the <b>Shout</b> action by actually using the helper application to change the implicit authorization.</string> </property> @@ -134,7 +134,7 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="6" column="1"> - <widget class="QComboBox" name="setCB"> + <widget class="TQComboBox" name="setCB"> <item> <property name="text"> <string>no</string> @@ -168,14 +168,14 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="7" column="1"> - <widget class="QPushButton" name="setPB"> + <widget class="TQPushButton" name="setPB"> <property name="text"> <string>Set!</string> </property> </widget> </item> <item row="8" column="0"> - <widget class="QLabel" name="deleteL_3"> + <widget class="TQLabel" name="deleteL_3"> <property name="text"> <string>The implicit authorization for the <b>Shout</b> action is set by the <b>Set</b> action. You can watch how different options can change behaviour of this action.</string> </property> @@ -185,7 +185,7 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="8" column="1"> - <widget class="QPushButton" name="shoutPB"> + <widget class="TQPushButton" name="shoutPB"> <property name="text"> <string>Shout!</string> </property> @@ -194,11 +194,11 @@ p, li { white-space: pre-wrap; } </layout> </item> <item> - <widget class="QListWidget" name="actionList"/> + <widget class="TQListWidget" name="actionList"/> </item> </layout> </widget> - <widget class="QMenuBar" name="menubar"> + <widget class="TQMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> @@ -207,19 +207,19 @@ p, li { white-space: pre-wrap; } <height>22</height> </rect> </property> - <widget class="QMenu" name="menuActions"> + <widget class="TQMenu" name="menuActions"> <property name="title"> <string>Actions</string> </property> </widget> <addaction name="menuActions"/> </widget> - <widget class="QToolBar" name="toolBar"> + <widget class="TQToolBar" name="toolBar"> <property name="windowTitle"> <string>toolBar</string> </property> <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextUnderIcon</enum> + <enum>TQt::ToolButtonTextUnderIcon</enum> </property> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> diff --git a/examples/PkExampleHelper.cpp b/examples/PkExampleHelper.cpp index 0258e700f..d6ecfdc7f 100644 --- a/examples/PkExampleHelper.cpp +++ b/examples/PkExampleHelper.cpp @@ -24,45 +24,45 @@ #include "polkitqt1-authority.h" -#include <QtDBus/QDBusConnection> -#include <QtCore/QTimer> -#include <QtCore/QDebug> -#include <QtXml/QDomDocument> +#include <TQtDBus/TQDBusConnection> +#include <TQtCore/TQTimer> +#include <TQtCore/TQDebug> +#include <TQtXml/TQDomDocument> #define MINUTE 60000 -using namespace PolkitQt1; +using namespace PolkitTQt1; PkExampleHelper::PkExampleHelper(int &argc, char **argv) - : QCoreApplication(argc, argv) + : TQCoreApplication(argc, argv) { - qDebug() << "Creating Helper"; + tqDebug() << "Creating Helper"; (void) new ExamplesAdaptor(this); // Register the DBus service - if (!QDBusConnection::systemBus().registerService("org.qt.policykit.examples")) { - qDebug() << QDBusConnection::systemBus().lastError().message();; - QTimer::singleShot(0, this, SLOT(quit())); + if (!TQDBusConnection::systemBus().registerService("org.qt.policykit.examples")) { + tqDebug() << TQDBusConnection::systemBus().lastError().message();; + TQTimer::singleShot(0, this, SLOT(quit())); return; } - if (!QDBusConnection::systemBus().registerObject("/", this)) { - qDebug() << "unable to register service interface to dbus"; - QTimer::singleShot(0, this, SLOT(quit())); + if (!TQDBusConnection::systemBus().registerObject("/", this)) { + tqDebug() << "unable to register service interface to dbus"; + TQTimer::singleShot(0, this, SLOT(quit())); return; } // Normally you will set a timeout so your application can // free some resources of the poor client machine ;) - QTimer::singleShot(MINUTE, this, SLOT(quit())); + TQTimer::singleShot(MINUTE, this, SLOT(quit())); } PkExampleHelper::~PkExampleHelper() { - qDebug() << "Destroying Helper"; + tqDebug() << "Destroying Helper"; } -bool PkExampleHelper::set(const QString &action) +bool PkExampleHelper::set(const TQString &action) { - qDebug() << "PkExampleHelper::set" << action; + tqDebug() << "PkExampleHelper::set" << action; // message().service() is the service name of the caller // We can check if the caller is authorized to the following action Authority::Result result; @@ -71,29 +71,29 @@ bool PkExampleHelper::set(const QString &action) result = Authority::instance()->checkAuthorizationSync("org.qt.policykit.examples.set", subject , Authority::AllowUserInteraction); if (result == Authority::Yes) { - qDebug() << message().service() << QString("Implicit authorization set to") << action; + tqDebug() << message().service() << TQString("Implicit authorization set to") << action; // Caller is authorized so we can perform the action return setValue(action); } else { - qDebug() << message().service() << QString("Can't set the implicit authorization"); + tqDebug() << message().service() << TQString("Can't set the implicit authorization"); // Caller is not authorized so the action can't be performed return false; } } -bool PkExampleHelper::setValue(const QString &action) +bool PkExampleHelper::setValue(const TQString &action) { // This action must be authorized first. It will set the implicit // authorization for the Shout action by editing the .policy file - QDomDocument doc = QDomDocument("policy"); - QFile file("/usr/share/polkit-1/actions/org.qt.policykit.examples.policy"); - if (!file.open(QIODevice::ReadOnly)) + TQDomDocument doc = TQDomDocument("policy"); + TQFile file("/usr/share/polkit-1/actions/org.qt.policykit.examples.policy"); + if (!file.open(TQIODevice::ReadOnly)) return false; doc.setContent(&file); file.close(); - QDomElement el = doc.firstChildElement("policyconfig"). + TQDomElement el = doc.firstChildElement("policyconfig"). firstChildElement("action"); - while (!el.isNull() && el.attribute("id", QString()) != "org.qt.policykit.examples.shout") { + while (!el.isNull() && el.attribute("id", TQString()) != "org.qt.policykit.examples.shout") { el = el.nextSiblingElement("action"); } el = el.firstChildElement("defaults"); @@ -101,9 +101,9 @@ bool PkExampleHelper::setValue(const QString &action) if (el.isNull()) return false; el.firstChild().toText().setData(action); - if (!file.open(QIODevice::WriteOnly)) + if (!file.open(TQIODevice::WriteOnly)) return false; - QTextStream stream(&file); + TQTextStream stream(&file); doc.save(stream, 2); file.close(); return true; diff --git a/examples/PkExampleHelper.h b/examples/PkExampleHelper.h index bf69e03f7..825a14bf0 100644 --- a/examples/PkExampleHelper.h +++ b/examples/PkExampleHelper.h @@ -22,20 +22,20 @@ #ifndef PKEXAMPLE_HELPER_H #define PKEXAMPLE_HELPER_H -#include <QtDBus/QDBusContext> -#include <QtCore/QCoreApplication> +#include <TQtDBus/TQDBusContext> +#include <TQtCore/TQCoreApplication> -class PkExampleHelper : public QCoreApplication, protected QDBusContext +class PkExampleHelper : public TQCoreApplication, protected TQDBusContext { Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.qt.policykit.examples") + TQ_CLASSINFO("D-Bus Interface", "org.qt.policykit.examples") public: PkExampleHelper(int &argc, char **argv); ~PkExampleHelper(); public Q_SLOTS: - bool set(const QString &action); - bool setValue(const QString &action); + bool set(const TQString &action); + bool setValue(const TQString &action); }; diff --git a/examples/agent/klistener.cpp b/examples/agent/klistener.cpp index 32bfb981a..147b95a67 100644 --- a/examples/agent/klistener.cpp +++ b/examples/agent/klistener.cpp @@ -18,61 +18,61 @@ * Boston, MA 02110-1301, USA. */ -#include <QtCore/QDebug> -#include <QInputDialog> +#include <TQtCore/TQDebug> +#include <TQInputDialog> #include "klistener.h" #include "agent/polkitqt1-agent-session.h" -using namespace PolkitQt1::Agent; +using namespace PolkitTQt1::Agent; -KListener::KListener(QObject *parent) +KListener::KListener(TQObject *parent) : Listener(parent) { - qDebug() << "Registering KDE listener"; + tqDebug() << "Registering KDE listener"; } // README: this is just testing code... -void KListener::initiateAuthentication(const QString &actionId, - const QString &message, - const QString &iconName, - const PolkitQt1::Details &details, - const QString &cookie, - const PolkitQt1::Identity::List &identities, +void KListener::initiateAuthentication(const TQString &actionId, + const TQString &message, + const TQString &iconName, + const PolkitTQt1::Details &details, + const TQString &cookie, + const PolkitTQt1::Identity::List &identities, AsyncResult *result) { - qDebug() << "initiateAuthentication for " << actionId << " with message " << message; - qDebug() << "iconName " << iconName; - qDebug() << details.keys(); - qDebug() << "cookie" << cookie; + tqDebug() << "initiateAuthentication for " << actionId << " with message " << message; + tqDebug() << "iconName " << iconName; + tqDebug() << details.keys(); + tqDebug() << "cookie" << cookie; - Q_FOREACH (const PolkitQt1::Identity &identity, identities) { - qDebug() << identity.toString(); + Q_FOREACH (const PolkitTQt1::Identity &identity, identities) { + tqDebug() << identity.toString(); Session *session; session = new Session(identity, cookie, result); - connect(session, SIGNAL(request(QString, bool)), this, SLOT(request(QString, bool))); + connect(session, SIGNAL(request(TQString, bool)), this, SLOT(request(TQString, bool))); connect(session, SIGNAL(completed(bool)), this, SLOT(completed(bool))); - connect(session, SIGNAL(showError(QString)), this, SLOT(showError(QString))); - connect(session, SIGNAL(showInfo(QString)), this, SLOT(showInfo(QString))); + connect(session, SIGNAL(showError(TQString)), this, SLOT(showError(TQString))); + connect(session, SIGNAL(showInfo(TQString)), this, SLOT(showInfo(TQString))); session->initiate(); } } bool KListener::initiateAuthenticationFinish() { - qDebug() << "initiateAuthenticationFinish()"; + tqDebug() << "initiateAuthenticationFinish()"; return true; } void KListener::cancelAuthentication() { - qDebug() << "Cancelling authentication"; + tqDebug() << "Cancelling authentication"; } -void KListener::request(const QString &request, bool echo) +void KListener::request(const TQString &request, bool echo) { - qDebug() << "Request: " << request; + tqDebug() << "Request: " << request; Session *session = (Session *)sender(); @@ -81,7 +81,7 @@ void KListener::request(const QString &request, bool echo) void KListener::completed(bool gainedAuthorization) { - qDebug() << "Completed: " << gainedAuthorization; + tqDebug() << "Completed: " << gainedAuthorization; Session *session = (Session *)sender(); session->result()->setCompleted(); @@ -89,12 +89,12 @@ void KListener::completed(bool gainedAuthorization) delete session; } -void KListener::showError(const QString &text) +void KListener::showError(const TQString &text) { - qDebug() << "Error: " << text; + tqDebug() << "Error: " << text; } -void KListener::showInfo(const QString &text) +void KListener::showInfo(const TQString &text) { - qDebug() << "Info: " << text; + tqDebug() << "Info: " << text; } diff --git a/examples/agent/klistener.h b/examples/agent/klistener.h index 2576acdca..d0e45c6ba 100644 --- a/examples/agent/klistener.h +++ b/examples/agent/klistener.h @@ -21,36 +21,36 @@ #ifndef POLKIT_QT_AGENT_KDE_LISTENER_H #define POLKIT_QT_AGENT_KDE_LISTENER_H -#include <QtCore/QObject> -#include <QtCore/QString> +#include <TQtCore/TQObject> +#include <TQtCore/TQString> #include "agent/polkitqt1-agent-listener.h" #include "core/polkitqt1-identity.h" #include "core/polkitqt1-details.h" #include "agent/polkitqt1-agent-session.h" -class KListener : public PolkitQt1::Agent::Listener +class KListener : public PolkitTQt1::Agent::Listener { Q_OBJECT - Q_DISABLE_COPY(KListener) + TQ_DISABLE_COPY(KListener) public: - KListener(QObject *parent = 0); + KListener(TQObject *parent = 0); ~KListener() {}; public Q_SLOTS: - void initiateAuthentication(const QString &actionId, - const QString &message, - const QString &iconName, - const PolkitQt1::Details &details, - const QString &cookie, - const PolkitQt1::Identity::List &identities, - PolkitQt1::Agent::AsyncResult *result); + void initiateAuthentication(const TQString &actionId, + const TQString &message, + const TQString &iconName, + const PolkitTQt1::Details &details, + const TQString &cookie, + const PolkitTQt1::Identity::List &identities, + PolkitTQt1::Agent::AsyncResult *result); bool initiateAuthenticationFinish(); void cancelAuthentication(); - void request(const QString &request, bool echo); + void request(const TQString &request, bool echo); void completed(bool gainedAuthorization); - void showError(const QString &text); - void showInfo(const QString &text); + void showError(const TQString &text); + void showInfo(const TQString &text); }; #endif diff --git a/examples/agent/main.cpp b/examples/agent/main.cpp index 682b04747..8e61f7066 100644 --- a/examples/agent/main.cpp +++ b/examples/agent/main.cpp @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ -#include <QApplication> +#include <TQApplication> #define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE 1 diff --git a/examples/agent/pkagentexample.cpp b/examples/agent/pkagentexample.cpp index ed36363ba..858376c22 100644 --- a/examples/agent/pkagentexample.cpp +++ b/examples/agent/pkagentexample.cpp @@ -3,15 +3,15 @@ #include <polkitagent/polkitagent.h> #include "pkagentexample.h" #include <glib-object.h> -#include <QtCore/QDebug> +#include <TQtCore/TQDebug> #include "polkitqt1-subject.h" PkAgentExample::PkAgentExample(int &argc, char **argv) - : QCoreApplication(argc, argv) + : TQCoreApplication(argc, argv) { g_type_init(); - PolkitQt1::UnixSessionSubject session(getpid()); + PolkitTQt1::UnixSessionSubject session(getpid()); m_listener.registerListener(session, "/org/kde/PolicyKit1/AuthenticationAgent"); } diff --git a/examples/agent/pkagentexample.h b/examples/agent/pkagentexample.h index 62c7035a5..61dfb3dab 100644 --- a/examples/agent/pkagentexample.h +++ b/examples/agent/pkagentexample.h @@ -24,11 +24,11 @@ #define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE 1 -#include <QtDBus/QDBusContext> -#include <QCoreApplication> +#include <TQtDBus/TQDBusContext> +#include <TQCoreApplication> #include "klistener.h" -class PkAgentExample : public QCoreApplication +class PkAgentExample : public TQCoreApplication { Q_OBJECT public: diff --git a/examples/main.cpp b/examples/main.cpp index e81f80409..602721d00 100644 --- a/examples/main.cpp +++ b/examples/main.cpp @@ -19,13 +19,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ -#include <QtGui/QApplication> +#include <TQtGui/TQApplication> #include "PkExample.h" int main(int argc, char *argv[]) { - QApplication app(argc, argv); + TQApplication app(argc, argv); PkExample example; example.show(); return app.exec(); |