本文整理汇总了C++中KApplication::dcopClient方法的典型用法代码示例。如果您正苦于以下问题:C++ KApplication::dcopClient方法的具体用法?C++ KApplication::dcopClient怎么用?C++ KApplication::dcopClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KApplication
的用法示例。
在下文中一共展示了KApplication::dcopClient方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
KAboutData aboutData( "ksnapshot", I18N_NOOP("KSnapshot"),
KSNAPVERSION, description, KAboutData::License_GPL,
"(c) 1997-2004, Richard J. Moore,\n(c) 2000, Matthias Ettrich,\n(c) 2002-2003 Aaron J. Seigo");
aboutData.addAuthor("Richard J. Moore",0, "[email protected]");
aboutData.addAuthor("Matthias Ettrich",0, "[email protected]");
aboutData.addAuthor("Aaron J. Seigo", 0, "[email protected]");
aboutData.addCredit( "Nadeem Hasan", I18N_NOOP("Region Grabbing\nReworked GUI"),
"[email protected]" );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication app;
KImageIO::registerFormats();
// Create top level window
KSnapshot *toplevel;
if ( args->isSet( "current" ) )
toplevel = new KSnapshot( 0, 0, true );
else
toplevel = new KSnapshot();
args->clear();
app.dcopClient()->setDefaultObject( toplevel->objId() );
toplevel->setCaption( app.makeStdCaption("") );
app.setMainWidget(toplevel);
toplevel->show();
return app.exec();
}
示例2: askUser
// TODO - make this register() or something like that and move dialog into main
static int askUser(KApplication &app, QString filename, bool &readonly)
{
QCString requestedName("keditbookmarks");
if(!filename.isEmpty())
requestedName += "-" + filename.utf8();
if(app.dcopClient()->registerAs(requestedName, false) == requestedName)
return true;
int ret = KMessageBox::warningYesNo(0, i18n("Another instance of %1 is already running, do you really "
"want to open another instance or continue work in the same instance?\n"
"Please note that, unfortunately, duplicate views are read-only.")
.arg(kapp->caption()),
i18n("Warning"), i18n("Run Another"), /* yes */
i18n("Continue in Same") /* no */);
if(ret == KMessageBox::No)
{
continueInWindow(requestedName);
return false;
}
else if(ret == KMessageBox::Yes)
{
readonly = true;
}
return true;
}
示例3: main
int main(int argc, char **argv)
{
if(argc > 1)
{
batch();
return 0;
}
KCmdLineArgs::init(argc, argv, "TestApp", "Tests the dcop familly of tools + libraries", "1.0"); // FIXME
KApplication app;
if(!app.dcopClient()->attach())
return 1;
app.dcopClient()->registerAs("TestApp");
new Test;
return app.exec();
}
示例4: main
int main(int argc, char *argv[])
{
KLocale::setMainCatalogue("kmailcvt");
KAboutData aboutData( "kmailcvt", I18N_NOOP("KMailCVT"),
"3", I18N_NOOP("KMail Import Filters"), KAboutData::License_GPL_V2,
I18N_NOOP("(c) 2000-2005, The KMailCVT developers"));
aboutData.addAuthor("Hans Dijkema",I18N_NOOP("Original author"), "[email protected]");
aboutData.addAuthor("Danny Kukawka", I18N_NOOP("Maintainer & New filters"), "[email protected]");
aboutData.addAuthor("Laurence Anderson", I18N_NOOP("New GUI & cleanups"), "[email protected]");
aboutData.addCredit("Daniel Molkentin", I18N_NOOP("New GUI & cleanups"), "[email protected]");
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
KMailCVT *kmailcvt = new KMailCVT();
a.setMainWidget(kmailcvt);
kmailcvt->show();
DCOPClient *client=a.dcopClient();
if (!client->attach()) {
return 1;
}
return a.exec();
}
示例5: main
int main(int argc, char *argv[])
{
KAboutData aboutData( "kimagemapeditor", I18N_NOOP("KImageMapEditor"),
VERSION, description, KAboutData::License_GPL,
"(C) 2001-2008 Jan Schaefer", 0, "http://www.nongnu.org/kimagemap/", "[email protected]");
aboutData.addAuthor("Jan Schaefer",0, "[email protected]");
aboutData.addCredit("Joerg Jaspert",I18N_NOOP("For helping me with the Makefiles, and creating the Debian package"));
aboutData.addCredit("Aaron Seigo and Michael",I18N_NOOP("For helping me fixing --enable-final mode"));
aboutData.addCredit("Antonio Crevillen",I18N_NOOP("For the Spanish translation"));
aboutData.addCredit("Fabrice Mous",I18N_NOOP("For the Dutch translation"));
aboutData.addCredit("Germain Chazot",I18N_NOOP("For the French translation"));
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KApplication a;
a.dcopClient()->registerAs(a.name());
if (a.isRestored())
{
RESTORE(KimeShell);
}
else
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if ( args->count() == 0 )
{
KimeShell *kimeShell = new KimeShell();
kimeShell->setStdout(args->isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openLastFile();
}
else
{
int i = 0;
for (; i < args->count(); i++ )
{
KimeShell *kimeShell = new KimeShell();
kimeShell->setStdout(args->isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openFile(args->url(i));
}
}
args->clear();
}
return a.exec();
}
示例6: main
int main(int argc, char **argv)
{
KLocale::setMainCatalogue("kasablanca");
KAboutData about("kasablanca", I18N_NOOP("kasablanca"), version, description,
KAboutData::License_GPL, "(C) 2004 Magnus Kulke", 0, 0,
"sikor_s[email protected]");
about.addAuthor( "Magnus Kulke", 0, "[email protected]" );
about.addAuthor( "Big Biff", 0, "[email protected]" );
about.addCredit( "Stefan Bogner", 0, "[email protected]" );
about.addCredit( "Christoph Thielecke", 0, "[email protected]" );
about.addCredit( "Richard Stellingwerf", 0, "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
// register ourselves as a dcop client
app.dcopClient()->registerAs(app.name(), false);
// see if we are starting with session management
if (app.isRestored())
{
RESTORE(Kasablanca);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0)
{
Kasablanca *widget = new Kasablanca;
widget->show();
}
else
{
int i = 0;
for (; i < args->count(); i++)
{
Kasablanca *widget = new Kasablanca;
widget->show();
// TODO: Load the ftp url passed on the command line.
// widget->load(args->url(i));
}
}
args->clear();
}
return app.exec();
}
示例7: main
int main(int argc, char **argv)
{
KCmdLineArgs::init(argc,argv,"dcoptest","dcoptest","","");
KApplication app;
DCOPClient &dcopclient=*(app.dcopClient());
TiEmuDCOP_stub *tiemuDCOP;
if (!dcopclient.attach())
{puts("DCOP error (#1).");return 1;}
QCStringList applist=dcopclient.registeredApplications();
QCString appname;
QCStringList::iterator it;
for (it = applist.begin(); it != applist.end(); ++it) {
if ((*it).contains(QRegExp("^tiemu-"))) {
appname = (*it);
break;
}
}
if (appname.isNull()) { // TiEmu not running
KRun::runCommand("tiemu");
do {
applist=dcopclient.registeredApplications();
for (it = applist.begin(); it != applist.end(); ++it) {
if ((*it).contains(QRegExp("^tiemu-"))) {
appname = (*it);
break;
}
}
} while (appname.isNull());
}
tiemuDCOP = new TiEmuDCOP_stub(appname,"TiEmuDCOP");
bool ready;
do {
ready=tiemuDCOP->ready_for_transfers();
if (!tiemuDCOP->ok())
{delete tiemuDCOP;dcopclient.detach();puts("DCOP error (#2).");return 2;}
} while (!ready);
#if 0 // This shouldn't be needed with the new ready_for_transfers().
if (!tiemuDCOP->turn_calc_on() || !tiemuDCOP->ok())
{delete tiemuDCOP;dcopclient.detach();puts("DCOP error (#3).");return 3;}
sleep(3); // give the emulated calculator time to react
#endif
if (!tiemuDCOP->execute_command(QString("2+3")) || !tiemuDCOP->ok())
{delete tiemuDCOP;dcopclient.detach();puts("DCOP error (#4).");return 4;}
delete tiemuDCOP;
if (!dcopclient.detach())
{puts("DCOP error (#5).");return 5;}
return 0;
}
示例8: main
int main(int argc, char **argv)
{
KAboutData aboutData("khc_indexbuilder", I18N_NOOP("KHelpCenter Index Builder"), HELPCENTER_VERSION, I18N_NOOP("The KDE Help Center"),
KAboutData::License_GPL, I18N_NOOP("(c) 2003, The KHelpCenter developers"));
aboutData.addAuthor("Cornelius Schumacher", 0, "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(options);
KUniqueApplication::addCmdLineOptions();
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if(args->count() != 2)
{
kdDebug(1402) << "Wrong number of arguments." << endl;
return 1;
}
QString cmdFile = args->arg(0);
QString indexDir = args->arg(1);
kdDebug(1402) << "cmdFile: " << cmdFile << endl;
kdDebug(1402) << "indexDir: " << indexDir << endl;
QFile file(indexDir + "/testaccess");
if(!file.open(IO_WriteOnly) || file.putch(' ') < 0)
{
kdDebug(1402) << "access denied" << endl;
return 2;
}
else
{
kdDebug(1402) << "can access" << endl;
file.remove();
}
app.dcopClient()->registerAs("khc_indexbuilder", false);
IndexBuilder builder(cmdFile);
QTimer::singleShot(0, &builder, SLOT(buildIndices()));
return app.exec();
}
示例9: main
int main(int argc, char **argv)
{
KAboutData about("composer", I18N_NOOP("Composer"), version, description,
KAboutData::License_GPL, "(C) 2007 sebastian", 0, 0, "[email protected]");
about.addAuthor( "sebastian", 0, "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
// register ourselves as a dcop client
app.dcopClient()->registerAs(app.name(), false);
// see if we are starting with session management
if (app.isRestored())
{
RESTORE(Composer);
}
else
{
// no session.. just start up normally
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0)
{
Composer *widget = new Composer;
widget->show();
}
else
{
int i = 0;
for (; i < args->count(); i++)
{
Composer *widget = new Composer;
widget->show();
widget->load(args->url(i));
}
}
args->clear();
}
return app.exec();
}
示例10: main
int main(int argc, char **argv)
{
KAboutData about("konjue", I18N_NOOP("Konjue"), version, description,
KAboutData::License_GPL, "(C) 2005 Pieter Pareit", 0, 0, "[email protected]");
about.addAuthor( "Pieter Pareit", 0, "[email protected]" );
about.addCredit( "Pierre Sarrazin", I18N_NOOP("Programmer of Verbiste, backend used by Konjue."),
"sarrazip AT sarrazip DOT com", "http://sarrazip.com" );
about.addCredit( "Sebastian Sariego Benitez", I18N_NOOP("Artist that created the icon for Konjue."),
"segfault AT kde DOT cl", "http://segfault.kde.cl" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
// register ourselves as a dcop client
app.dcopClient()->registerAs(app.name(), false);
// see if we are starting with session management
if (app.isRestored())
{
RESTORE(Konjue);
}
else
{
// no session.. just start up normally, create window
Konjue *widget = new Konjue;
widget->show();
// load all verbs that were give as arguments
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
for (int i = 0; i < args->count(); i++)
{
widget->displayVerb( args->arg( i ) );
}
args->clear();
}
return app.exec();
}
示例11: aboutData
//.........这里部分代码省略.........
QStrList eargs;
const char *shell = 0;
if(!args->getOption("e").isEmpty())
{
if(args->isSet("ls"))
KCmdLineArgs::usage(i18n("You can't use BOTH -ls and -e.\n"));
shell = strdup(args->getOption("e"));
eargs.append(shell);
for(int i = 0; i < args->count(); i++)
eargs.append(args->arg(i));
if(title.isEmpty() && (kapp->caption() == kapp->aboutData()->programName()))
{
title = QFile::decodeName(shell); // program executed in the title bar
}
showtip = false;
}
QCString sz = "";
sz = args->getOption("vt_sz");
histon = args->isSet("hist");
menubaron = args->isSet("menubar");
tabbaron = args->isSet("tabbar") && args->isSet("toolbar");
frameon = args->isSet("frame");
scrollbaron = args->isSet("scrollbar");
QCString wname = qtargs->getOption("name");
full_script = args->isSet("script");
auto_close = args->isSet("close");
fixed_size = !args->isSet("resize");
if(!full_script)
a->dcopClient()->setQtBridgeEnabled(false);
QCString type = "";
if(args->isSet("type"))
{
type = args->getOption("type");
}
if(args->isSet("types"))
{
QStringList types = KGlobal::dirs()->findAllResources("appdata", "*.desktop", false, true);
types.sort();
for(QStringList::ConstIterator it = types.begin(); it != types.end(); ++it)
{
QString file = *it;
file = file.mid(file.findRev('/') + 1);
if(file.endsWith(".desktop"))
file = file.left(file.length() - 8);
printf("%s\n", QFile::encodeName(file).data());
}
return 0;
}
if(args->isSet("schemas") || args->isSet("schemata"))
{
ColorSchemaList colors;
colors.checkSchemas();
for(int i = 0; i < (int)colors.count(); i++)
{
ColorSchema *schema = colors.find(i);
QString relPath = schema->relPath();
if(!relPath.isEmpty())
printf("%s\n", QFile::encodeName(relPath).data());
}