Use new TQ_METHOD, TQ_SIGNAL, TQ_SLOT defines

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/7/head
Michele Calgaro 11 months ago
parent 7e4828f14a
commit 7c53a87adc
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -74,9 +74,9 @@ This demonstrates the use of ActionButtons, that lets you associate multiple but
single action with extreme ease. \c listenPB and \c listenCB are kept in sync with the action. single action with extreme ease. \c listenPB and \c listenCB are kept in sync with the action.
\code \code
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
\endcode \endcode
Those three signals are all you need to control the action and the activation. Action::activated() Those three signals are all you need to control the action and the activation. Action::activated()

@ -145,32 +145,32 @@ PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application",
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
// this signal is emitted when the user click on the action, // this signal is emitted when the user click on the action,
// it will only happen if it was inserted in a TQMenu or a TQToolBar // it will only happen if it was inserted in a TQMenu or a TQToolBar
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
// This signal was propagated from the TQButton just for // This signal was propagated from the TQButton just for
// convenience in this case we don't have any benefit but the code // convenience in this case we don't have any benefit but the code
// look cleaner // look cleaner
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
// this is the Action activated signal, it is always emmited whenever // this is the Action activated signal, it is always emmited whenever
// someone click and get authorized to do the action // someone click and get authorized to do the action
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
bt = new ActionButton(cryPB, "org.tqt.policykit.examples.cry", this); bt = new ActionButton(cryPB, "org.tqt.policykit.examples.cry", this);
bt->setText("Cry!"); bt->setText("Cry!");
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png")); bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"));
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
bt = new ActionButton(bleedPB, "org.tqt.policykit.examples.bleed", this); bt = new ActionButton(bleedPB, "org.tqt.policykit.examples.bleed", this);
bt->setText("Bleed!"); bt->setText("Bleed!");
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/action-locked-default.png")); bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/action-locked-default.png"));
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
// This action is more customized // This action is more customized
bt = new ActionButton(playPB, "org.tqt.policykit.examples.play", this); bt = new ActionButton(playPB, "org.tqt.policykit.examples.play", this);
@ -191,9 +191,9 @@ PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application",
bt->setToolTip("Go ahead, play!", Action::Yes); bt->setToolTip("Go ahead, play!", Action::Yes);
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
bt = new ActionButton(listenPB, "org.tqt.policykit.examples.listen", this); bt = new ActionButton(listenPB, "org.tqt.policykit.examples.listen", this);
bt->setText("Listen!"); bt->setText("Listen!");
@ -202,9 +202,9 @@ PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application",
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes); bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes);
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
bt = new ActionButton(deletePB, "org.tqt.policykit.examples.delete", this); bt = new ActionButton(deletePB, "org.tqt.policykit.examples.delete", this);
bt->setText("Delete!"); bt->setText("Delete!");
@ -213,9 +213,9 @@ PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application",
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes); bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes);
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
bt = new ActionButton(setPB, "org.tqt.policykit.examples.set", this); bt = new ActionButton(setPB, "org.tqt.policykit.examples.set", this);
bt->setText("Set!"); bt->setText("Set!");
@ -224,9 +224,9 @@ PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application",
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes); bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-yes.png"), Action::Yes);
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
bt = new ActionButton(shoutPB, "org.tqt.policykit.examples.shout", this); bt = new ActionButton(shoutPB, "org.tqt.policykit.examples.shout", this);
bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-no.png"), Action::No); bt->setIconSet(TQPixmap("/usr/share/apps/polkit-tqt/icons/custom-no.png"), Action::No);
@ -237,9 +237,9 @@ PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application",
bt->setText("Shout!", Action::Yes); bt->setText("Shout!", Action::Yes);
::tqt_cast<TQAction*>(bt)->addTo(menuActions); ::tqt_cast<TQAction*>(bt)->addTo(menuActions);
::tqt_cast<TQAction*>(bt)->addTo(toolBar); ::tqt_cast<TQAction*>(bt)->addTo(toolBar);
connect(bt, SIGNAL(activated()), this, SLOT(activateAction())); connect(bt, TQ_SIGNAL(activated()), this, TQ_SLOT(activateAction()));
connect(bt, SIGNAL(clicked(TQButton*, bool)), bt, SLOT(activate())); connect(bt, TQ_SIGNAL(clicked(TQButton*, bool)), bt, TQ_SLOT(activate()));
connect(bt, SIGNAL(authorized()), this, SLOT(actionActivated())); connect(bt, TQ_SIGNAL(authorized()), this, TQ_SLOT(actionActivated()));
} }
void PkExample::languageChange() void PkExample::languageChange()

@ -52,7 +52,7 @@ PkExampleHelper::PkExampleHelper(int argc, char **argv) : TQApplication(argc, ar
return; return;
} }
// Exit if not used for 10 minutes // Exit if not used for 10 minutes
TQTimer::singleShot(600000, this, TQT_SLOT(quit())); TQTimer::singleShot(600000, this, TQ_SLOT(quit()));
tqDebug("Register successful"); tqDebug("Register successful");
} }

@ -52,13 +52,13 @@ void TQtListener::initiateAuthentication(const TQString &actionId, const TQStrin
{ {
tqDebug(identity.toString()); tqDebug(identity.toString());
Session *session = new Session(identity, cookie, result); Session *session = new Session(identity, cookie, result);
connect(session, TQT_SIGNAL(request(const TQString&, bool)), this, connect(session, TQ_SIGNAL(request(const TQString&, bool)), this,
TQT_SLOT(request(const TQString&, bool))); TQ_SLOT(request(const TQString&, bool)));
connect(session, TQT_SIGNAL(completed(bool)), this, TQT_SLOT(completed(bool))); connect(session, TQ_SIGNAL(completed(bool)), this, TQ_SLOT(completed(bool)));
connect(session, TQT_SIGNAL(showError(const TQString&)), this, connect(session, TQ_SIGNAL(showError(const TQString&)), this,
TQT_SLOT(showError(const TQString&))); TQ_SLOT(showError(const TQString&)));
connect(session, TQT_SIGNAL(showInfo(const TQString&)), this, connect(session, TQ_SIGNAL(showInfo(const TQString&)), this,
TQT_SLOT(showInfo(const TQString&))); TQ_SLOT(showInfo(const TQString&)));
session->initiate(); session->initiate();
} }
} }

@ -28,6 +28,6 @@ int main(int argc, char *argv[])
TQApplication app(argc, argv); TQApplication app(argc, argv);
PkExample *example = new PkExample; PkExample *example = new PkExample;
example->show(); example->show();
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); app.connect(&app, TQ_SIGNAL(lastWindowClosed()), &app, TQ_SLOT(quit()));
return app.exec(); return app.exec();
} }

@ -191,7 +191,7 @@ Action::Action(const TQString &actionId, TQObject *parent) : TQAction(parent), d
setPolkitAction(actionId); setPolkitAction(actionId);
// track the config changes to update the action // track the config changes to update the action
connect(Authority::instance(), SIGNAL(configChanged()), this, SLOT(slotConfigChanged())); connect(Authority::instance(), TQ_SIGNAL(configChanged()), this, TQ_SLOT(slotConfigChanged()));
} }
Action::~Action() Action::~Action()

@ -40,8 +40,8 @@ namespace Gui
void ActionButtonPrivate::addButton(TQButton *button) void ActionButtonPrivate::addButton(TQButton *button)
{ {
buttons.append(button); buttons.append(button);
TQObject::connect(button, TQT_SIGNAL(clicked()), q, TQT_SLOT(streamClicked())); TQObject::connect(button, TQ_SIGNAL(clicked()), q, TQ_SLOT(streamClicked()));
TQObject::connect(q, TQT_SIGNAL(toggled(bool)), button, TQT_SLOT(toggle())); TQObject::connect(q, TQ_SIGNAL(toggled(bool)), button, TQ_SLOT(toggle()));
q->updateButton(); q->updateButton();
} }
@ -49,8 +49,8 @@ void ActionButtonPrivate::removeButton(TQButton *button)
{ {
if (buttons.contains(button)) if (buttons.contains(button))
{ {
TQObject::disconnect(button, SIGNAL(clicked(bool)), q, SLOT(streamClicked())); TQObject::disconnect(button, TQ_SIGNAL(clicked(bool)), q, TQ_SLOT(streamClicked()));
TQObject::disconnect(q, SIGNAL(toggled(bool)), button, SLOT(toggle())); TQObject::disconnect(q, TQ_SIGNAL(toggled(bool)), button, TQ_SLOT(toggle()));
TQValueList<TQButton*>::iterator butIt = buttons.find(button); TQValueList<TQButton*>::iterator butIt = buttons.find(button);
if (butIt != buttons.end()) if (butIt != buttons.end())
{ {
@ -67,7 +67,7 @@ ActionButton::ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQ
: Action(actionId, parent), d(&dd) : Action(actionId, parent), d(&dd)
{ {
d->q = this; d->q = this;
connect(this, TQT_SIGNAL(dataChanged()), this, TQT_SLOT(updateButton())); connect(this, TQ_SIGNAL(dataChanged()), this, TQ_SLOT(updateButton()));
} }
ActionButton::ActionButton(TQButton *button, const TQString &actionId, TQObject *parent) ActionButton::ActionButton(TQButton *button, const TQString &actionId, TQObject *parent)
@ -77,7 +77,7 @@ ActionButton::ActionButton(TQButton *button, const TQString &actionId, TQObject
d->buttons.append(button); d->buttons.append(button);
setButton(button); setButton(button);
connect(this, TQT_SIGNAL(dataChanged()), this, TQT_SLOT(updateButton())); connect(this, TQ_SIGNAL(dataChanged()), this, TQ_SLOT(updateButton()));
} }
ActionButton::~ActionButton() ActionButton::~ActionButton()

Loading…
Cancel
Save