本文整理汇总了C++中DCOPClient::setNotifications方法的典型用法代码示例。如果您正苦于以下问题:C++ DCOPClient::setNotifications方法的具体用法?C++ DCOPClient::setNotifications怎么用?C++ DCOPClient::setNotifications使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCOPClient
的用法示例。
在下文中一共展示了DCOPClient::setNotifications方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
// nspluginviewer is a helper app, it shouldn't do session management at all
setenv("SESSION_MANAGER", "", 1);
// trap X errors
kdDebug(1430) << "1 - XSetErrorHandler" << endl;
XSetErrorHandler(x_errhandler);
setvbuf(stderr, NULL, _IONBF, 0);
kdDebug(1430) << "2 - parseCommandLine" << endl;
parseCommandLine(argc, argv);
#if QT_VERSION < 0x030100
// Create application
kdDebug(1430) << "3 - XtToolkitInitialize" << endl;
XtToolkitInitialize();
g_appcon = XtCreateApplicationContext();
Display *dpy = XtOpenDisplay(g_appcon, NULL, "nspluginviewer", "nspluginviewer", 0, 0, &argc, argv);
_notifiers[0].setAutoDelete(TRUE);
_notifiers[1].setAutoDelete(TRUE);
_notifiers[2].setAutoDelete(TRUE);
kdDebug(1430) << "4 - KXtApplication app" << endl;
KLocale::setMainCatalogue("nsplugin");
KXtApplication app(dpy, argc, argv, "nspluginviewer");
#else
kdDebug(1430) << "3 - create QXtEventLoop" << endl;
QXtEventLoop integrator("nspluginviewer");
parseCommandLine(argc, argv);
KLocale::setMainCatalogue("nsplugin");
kdDebug(1430) << "4 - create KApplication" << endl;
KApplication app(argc, argv, "nspluginviewer");
GlibEvents glibevents;
#endif
{
KConfig cfg("kcmnspluginrc", true);
cfg.setGroup("Misc");
int v = KCLAMP(cfg.readNumEntry("Nice Level", 0), 0, 19);
if(v > 0)
{
nice(v);
}
v = cfg.readNumEntry("Max Memory", 0);
if(v > 0)
{
rlimit rl;
memset(&rl, 0, sizeof(rl));
if(0 == getrlimit(RLIMIT_AS, &rl))
{
rl.rlim_cur = kMin(v, int(rl.rlim_max));
setrlimit(RLIMIT_AS, &rl);
}
}
}
// initialize the dcop client
kdDebug(1430) << "5 - app.dcopClient" << endl;
DCOPClient *dcop = app.dcopClient();
if(!dcop->attach())
{
KMessageBox::error(NULL, i18n("There was an error connecting to the Desktop "
"communications server. Please make sure that "
"the 'dcopserver' process has been started, and "
"then try again."),
i18n("Error Connecting to DCOP Server"));
exit(1);
}
kdDebug(1430) << "6 - dcop->registerAs" << endl;
if(g_dcopId)
g_dcopId = dcop->registerAs(g_dcopId, false);
else
g_dcopId = dcop->registerAs("nspluginviewer");
dcop->setNotifications(true);
// create dcop interface
kdDebug(1430) << "7 - new NSPluginViewer" << endl;
NSPluginViewer *viewer = new NSPluginViewer("viewer", 0);
// start main loop
#if QT_VERSION < 0x030100
kdDebug(1430) << "8 - XtAppProcessEvent" << endl;
while(!g_quit)
XtAppProcessEvent(g_appcon, XtIMAll);
#else
kdDebug(1430) << "8 - app.exec()" << endl;
app.exec();
#endif
// delete viewer
delete viewer;
}
示例2: dock
void ExtensionProxy::dock(const TQCString& callbackID)
{
kdDebug(1210) << "Callback ID: " << callbackID << endl;
_callbackID = callbackID;
// try to attach to DCOP server
DCOPClient* dcop = kapp->dcopClient();
dcop->setNotifications(true);
connect(dcop, TQT_SIGNAL(applicationRemoved(const TQCString&)),
TQT_SLOT(slotApplicationRemoved(const TQCString&)));
WId win;
// get docked
{
TQCString replyType;
TQByteArray data, replyData;
TQDataStream dataStream( data, IO_WriteOnly );
int actions = 0;
if(_extension) actions = _extension->actions();
dataStream << actions;
int type = 0;
if (_extension) type = static_cast<int>(_extension->type());
dataStream << type;
// we use "call" to know whether it was sucessful
int screen_number = 0;
if (tqt_xdisplay())
screen_number = DefaultScreen(tqt_xdisplay());
TQCString appname;
if (screen_number == 0)
appname = "kicker";
else
appname.sprintf("kicker-screen-%d", screen_number);
if ( !dcop->call(appname, _callbackID, "dockRequest(int,int)",
data, replyType, replyData ) )
{
kdError() << "Failed to dock into the panel." << endl;
exit(0);
}
TQDataStream reply( replyData, IO_ReadOnly );
reply >> win;
}
if (win) {
if (_extension)
{
_extension->hide();
}
QXEmbed::initialize();
QXEmbed::embedClientIntoWindow( _extension, win );
}
else {
kdError() << "Failed to dock into the panel." << endl;
if(_extension) delete _extension;
exit(0);
}
}