本文整理汇总了C++中KCmdLineArgs::url方法的典型用法代码示例。如果您正苦于以下问题:C++ KCmdLineArgs::url方法的具体用法?C++ KCmdLineArgs::url怎么用?C++ KCmdLineArgs::url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KCmdLineArgs
的用法示例。
在下文中一共展示了KCmdLineArgs::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, "testkhtml", 0, ki18n("Testkhtml"), "1.0",
ki18n("a basic web browser using the KHTML library"));
KCmdLineOptions options;
options.add("+file", ki18n("url to open"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0)
{
KCmdLineArgs::usage();
::exit( 1 );
}
TestKHTML *test = new TestKHTML;
if (args->url(0).url().right(4).toLower() == ".xml")
{
KParts::OpenUrlArguments args(test->doc()->arguments());
args.setMimeType("text/xml");
test->doc()->setArguments(args);
}
test->openUrl(args->url(0));
test->show();
return app.exec();
}
示例2: newInstance
int KOrganizerApp::newInstance()
{
kdDebug(5850) << "KOApp::newInstance()" << endl;
static bool first = true;
if ( isRestored() && first ) {
KOrg::MainWindow *korg = ActionManager::findInstance( KURL() );
if ( korg ) {
KOrg::StdCalendar::self()->load();
korg->view()->updateCategories();
korg->view()->updateView();
}
first = false;
return 0;
}
first = false;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KOGlobals::self()->alarmClient()->startDaemon();
// No filenames given => all other args are meaningless, show main Window
if ( args->count() <= 0 ) {
processCalendar( KURL() );
return 0;
}
// If filenames wer given as arguments, load them as calendars, one per window.
if ( args->isSet( "open" ) ) {
for( int i = 0; i < args->count(); ++i ) {
processCalendar( args->url( i ) );
}
} else {
// Import, merge, or ask => we need the resource calendar window anyway.
processCalendar( KURL() );
KOrg::MainWindow *korg = ActionManager::findInstance( KURL() );
if ( !korg ) {
kdError() << "Unable to find default calendar resources view." << endl;
return -1;
}
// Check for import, merge or ask
if ( args->isSet( "import" ) ) {
for( int i = 0; i < args->count(); ++i ) {
korg->actionManager()->addResource( args->url( i ) );
}
} else if ( args->isSet( "merge" ) ) {
for( int i = 0; i < args->count(); ++i ) {
korg->actionManager()->mergeURL( args->url( i ).url() );
}
} else {
for( int i = 0; i < args->count(); ++i ) {
korg->actionManager()->importCalendar( args->url( i ) );
}
}
}
kdDebug(5850) << "KOApp::newInstance() done" << endl;
return 0;
}
示例3: aboutData
extern "C" KDE_EXPORT int kdemain (int argc, char *argv[]) {
setsid ();
KAboutData aboutData ("kmplayer", 0, ki18n("KMPlayer"),
KMPLAYER_VERSION_STRING,
ki18n ("Media player."),
KAboutData::License_GPL,
ki18n ("(c) 2002-2009, Koos Vriezen"),
KLocalizedString(),
I18N_NOOP ("http://kmplayer.kde.org"));
aboutData.addAuthor(ki18n("Koos Vriezen"), ki18n("Maintainer"),"[email protected]");
KCmdLineArgs::init (argc, argv, &aboutData);
KCmdLineOptions options;
options.add ("+[File]", ki18n ("file to open"));
KCmdLineArgs::addCmdLineOptions (options);
KMPlayer::Ids::init();
KApplication app;
QPointer <KMPlayerApp> kmplayer;
if (app.isSessionRestored ()) {
RESTORE (KMPlayerApp);
} else {
kmplayer = new KMPlayerApp ();
kmplayer->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KUrl url;
if (args->count () == 1)
url = args->url (0);
if (args->count () > 1)
for (int i = 0; i < args->count (); i++) {
KUrl url = args->url (i);
if (url.url ().indexOf ("://") < 0)
url = KUrl (QFileInfo (url.url ()).absoluteFilePath ());
if (url.isValid ())
kmplayer->addUrl (url);
}
kmplayer->openDocumentFile (url);
args->clear ();
}
int retvalue = app.exec ();
delete kmplayer;
KMPlayer::Ids::reset();
return retvalue;
}
示例4: doCopy
bool ClientApp::doCopy( int firstArg )
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
int argc = args->count();
KUrl::List srcLst;
for ( int i = firstArg; i <= argc - 2; i++ )
srcLst.append( args->url(i) );
KIO::Job * job = KIO::copy( srcLst, args->url(argc - 1), s_jobFlags );
if ( !s_interactive )
job->setUiDelegate( 0 );
connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
this->exec();
return m_ok;
}
示例5: servURL
SvnHelper::SvnHelper():KApplication() {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
#ifdef Q_WS_X11
m_id=KWindowSystem::activeWindow();
KWindowSystem::activateWindow(m_id);
#else
m_id = 0;
#endif
KUrl::List list;
for ( int i = 0 ; i < args->count() ; i++ )
list << args->url(i);
if (args->isSet("u")) {
kDebug(7128) << "update " << list;
const KUrl servURL("svn+http://this_is_a_fake_URL_and_this_is_normal/");
//FIXME when 1.2 is out (move the loop inside kio_svn's ::update)
for ( QList<KUrl>::const_iterator it = list.constBegin(); it != list.constEnd() ; ++it ) {
QByteArray parms;
QDataStream s( &parms, QIODevice::WriteOnly );
int cmd = 2;
int rev = -1;
kDebug(7128) << "updating : " << (*it).prettyUrl();
s << cmd << *it << rev << QString( "HEAD" );
KIO::SimpleJob * job = KIO::special(servURL, parms);
connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
KIO::NetAccess::synchronousRun( job, 0 );
}
} else if (args->isSet("c")) {
示例6: main
int main(int argc, char ** argv)
{
KCmdLineOptions options;
options.add("+URL1", ki18n("The first URL to play"));
options.add("+URL2", ki18n("The second URL to play"));
KAboutData about("crossfade", 0, ki18n("Phonon Crossfade Example"),
"1.0", KLocalizedString(),
KAboutData::License_LGPL);
about.addAuthor(ki18n("Matthias Kretz"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KUrl url1;
KUrl url2;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 2)
{
url1 = args->url(0);
url2 = args->url(1);
if (url1.isValid() && url2.isValid())
{
Crossfader xfader(url1, url2);
return app.exec();
}
}
return 1;
}
示例7: main
int main(int argc, char* argv[])
{
PLEAboutData aboutData;
aboutData.setAppName("photolayoutseditor");
aboutData.setCatalogName("kipiplugin_photolayoutseditor");
KCmdLineArgs::init(argc,argv,&aboutData);
KCmdLineOptions options;
options.add("+file", ki18n("Input file"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
aboutData.setProgramLogo(KIcon("photolayoutseditor"));
PhotoLayoutsEditor* w = PhotoLayoutsEditor::instance(0);
w->setAttribute(Qt::WA_DeleteOnClose, true);
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count())
{
KUrl url = args->url(0);
if (url.isValid())
w->open(url);
}
w->show();
int result = app.exec();
return result;
}
示例8: main
int main(int argc, char **argv)
{
KAboutData about("d3lphin",
I18N_NOOP("Dolphin"),
"0.9.2",
I18N_NOOP("File Manager"),
KAboutData::License_GPL,
"(C) 2007 Marcel Juhnke");
about.setHomepage("https://marrat.homelinux.org/D3lphin");
about.setBugAddress("[email protected]");
about.addAuthor("Marcel Juhnke", I18N_NOOP("Maintainer and developer"), "[email protected]");
about.addAuthor("Michael Austin", I18N_NOOP("Documentation"), "[email protected]");
about.addAuthor("Orville Bennett", I18N_NOOP("Documentation"), "[email protected]");
about.addCredit("Peter Penz", I18N_NOOP("... for the great original Dolphin"));
about.addCredit("Cvetoslav Ludmiloff, Stefan Monov", I18N_NOOP("... for their development on the original Dolphin"));
about.addCredit("Aaron J. Seigo", I18N_NOOP("... for the great support and the amazing patches for the orignal Dolphin"));
about.addCredit("Patrice Tremblay, Gregor Kalisnik, Filip Brcic, Igor Stepin and Jan Mette", I18N_NOOP("... for their patches"));
about.addCredit("Ain, Itai, Ivan, Jannick, Stephane, Patrice, Piotr, Stefano and Power On",
I18N_NOOP("... for their translations"));
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
Dolphin& mainWin = Dolphin::mainWin();
mainWin.show();
if (app.isRestored()) {
int n = 1;
while (KMainWindow::canBeRestored(n)){
Dolphin::mainWin().restore(n);
++n;
}
} else {
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count() > 0) {
mainWin.activeView()->setURL(args->url(0));
for (int i = 1; i < args->count(); ++i) {
KRun::run("d3lphin", args->url(i));
}
}
args->clear();
}
return app.exec();
}
示例9: cg
KonfUpdate::KonfUpdate()
: m_textStream(0), m_file(0)
{
bool updateAll = false;
m_oldConfig1 = 0;
m_oldConfig2 = 0;
m_newConfig = 0;
m_config = new KConfig("kconf_updaterc");
KConfigGroup cg(m_config, QString());
QStringList updateFiles;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
m_debug = args->isSet("debug");
m_bUseConfigInfo = false;
if (args->isSet("check")) {
m_bUseConfigInfo = true;
QString file = KStandardDirs::locate("data", "kconf_update/" + args->getOption("check"));
if (file.isEmpty()) {
qWarning("File '%s' not found.", args->getOption("check").toLocal8Bit().data());
log() << "File '" << args->getOption("check") << "' passed on command line not found" << endl;
return;
}
updateFiles.append(file);
} else if (args->count()) {
for (int i = 0; i < args->count(); i++) {
KUrl url = args->url(i);
if (!url.isLocalFile()) {
KCmdLineArgs::usageError(i18n("Only local files are supported."));
}
updateFiles.append(url.path());
}
} else {
if (cg.readEntry("autoUpdateDisabled", false))
return;
updateFiles = findUpdateFiles(true);
updateAll = true;
}
for (QStringList::ConstIterator it = updateFiles.constBegin();
it != updateFiles.constEnd();
++it) {
updateFile(*it);
}
if (updateAll && !cg.readEntry("updateInfoAdded", false)) {
cg.writeEntry("updateInfoAdded", true);
updateFiles = findUpdateFiles(false);
for (QStringList::ConstIterator it = updateFiles.constBegin();
it != updateFiles.constEnd();
++it) {
checkFile(*it);
}
updateFiles.clear();
}
}
示例10: main
int main(int argc, char **argv)
{
KAboutData about("khipu", "gplacs", ki18n(I18N_NOOP("Khipu")), version, ki18n(description),
KAboutData::License_GPL, ki18n("(C) 2010-2012, Percy Camilo Triveño Aucahuasi"));
about.addAuthor(ki18n("Percy Camilo Triveño Aucahuasi"), ki18n("Main developer"), "[email protected]");
about.addCredit(ki18n("Punit Mehta"), ki18n("GSoC-2013 student - Persistance file support. Plot-dictionary support. Worked for application actions, command-line improvements and space filtering. Several bug fixings"), "[email protected]");
about.addCredit(ki18n("Manuel Álvarez Blanco"), ki18n("Thesis mentor - Guide and supervision during project conception. Bibliographical support. Numeric Mathematics and Algorithms support"), "");
about.addCredit(ki18n("José Ignacio Cuevas Gonzáles"), ki18n("Thesis mentor - Supervision, Product Guide, Product promotion and former Client"), "[email protected]");
about.addCredit(ki18n("Eduardo Fernandini Capurro"), ki18n("Thesis mentor - Supervision, Bibliographical Support, Product Guide and former Client"), "[email protected]");
about.addCredit(ki18n("Jaime Urbina Pereyra"), ki18n("Thesis mentor - Supervision and former Main Project Mentor"), "[email protected]");
about.addCredit(ki18n("Aleix Pol Gonzalez"), ki18n("KAlgebra and Analitza parser author, both vitals for the project"));
about.addCredit(ki18n("José Fernando Ramos Ramirez"), ki18n("First version of Famous Curves Database. Build former windows installer"), "[email protected]");
about.addCredit(ki18n("Susan Pamela Rios Sarmiento"), ki18n("First version of Famous Curves Database"), "[email protected]");
about.addCredit(ki18n("Edgar Velasquez"), ki18n("2D Improvements"));
about.addCredit(ki18n("Jose Torres Cardenas"), ki18n("3D Improvements"));
about.addCredit(ki18n("Elizabeth Portilla Flores"), ki18n("3D Improvements"));
about.addCredit(ki18n("Paul Murat Landauro Minaya"), ki18n("3D Improvements"));
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("+[URL]", ki18n( "A Khipu-file to open" ));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
MainWindow *mainWindow = new MainWindow;
if (app.isSessionRestored()) {
RESTORE(MainWindow)
} else {
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() == 0) {
mainWindow->checkforAutoSavedFile();
mainWindow->show();
} else {
int i = 0;
bool exit = false;
for (; i < args->count(); i++) {
if (i==0) {
if(args->arg(0)!="ignoreautosavedfile"){
if (!(mainWindow->openFile(args->url(0).path())))
exit = true;
}
}
mainWindow->show();
}
if (exit)
mainWindow->deleteLater(); // can't open a khipu file, so just exit !
}
args->clear();
}
return app.exec();
}
示例11: 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();
}
示例12: doList
bool ClientApp::doList( int firstArg )
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KUrl dir = args->url(firstArg);
KIO::Job * job = KIO::listDir(dir, KIO::HideProgressInfo);
if ( !s_interactive )
job->setUiDelegate(0);
connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)));
connect(job, SIGNAL(result(KJob *)), this, SLOT(slotResult(KJob *)));
this->exec();
return m_ok;
}
示例13: main
int main(int argc, char** argv) {
KAboutData about("kphotobook", I18N_NOOP("KPhotoBook"), version, description,
KAboutData::License_GPL, "(C) 2003 Michael Christen",
0, // free text, can contain new lines
"http://kphotobook.sourceforge.net",
"[email protected]");
about.addAuthor("Michael Christen", "The master chief developer.", "[email protected]" );
about.addAuthor("Thomas Christen", "One of Santa's greater helpers.\nHelps me creating icons and writing the website and the documentation.", "[email protected]");
about.addAuthor("Stefan Fink", "One of Santa's little helpers.\nAdvises in design and usability questions.");
about.addAuthor("Daniel Gerber", "One of Santa's little helpers.\nAdvises in design and usability questions.");
about.addCredit("George W. Bush, President of the USA", "For being a stupid little git.", "[email protected]" );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
KMdi::MdiMode mdiMode = KMdi::IDEAlMode;
if (Settings::generalViewMode() == Settings::EnumGeneralViewMode::TabPageMode) {
mdiMode = KMdi::TabPageMode;
}
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if (args->count() == 0) {
KPhotoBook* widget = new KPhotoBook(mdiMode);
widget->show();
// try to load last opened file
QString lastFileName = Settings::fileSystemLastOpenedFile();
if (!lastFileName.isEmpty()) {
QFileInfo lastFile(lastFileName);
widget->load(lastFile);
}
} else {
int i = 0;
for (; i < args->count(); i++) {
QFileInfo file(args->url(i).path());
KPhotoBook* widget = new KPhotoBook(mdiMode);
widget->show();
widget->load(file);
}
}
args->clear();
return app.exec();
}
示例14: aboutData
int
main (int argc, char **argv)
{
KAboutData aboutData("ksokoban", 0, ki18n("KSokoban"),
version, ki18n(description), KAboutData::License_GPL,
ki18n("(c) 1998-2001 Anders Widell"), KLocalizedString(),
"http://hem.passagen.se/awl/ksokoban/");
aboutData.addAuthor(ki18n("Anders Widell"), KLocalizedString(),
"[email protected]",
"http://hem.passagen.se/awl/");
aboutData.addCredit(ki18n("David W. Skinner"),
ki18n("For contributing the Sokoban levels included in this game"),
"[email protected]",
"http://users.bentonrea.com/~sasquatch/");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("+[file]", ki18n("Level collection file to load"));
KCmdLineArgs::addCmdLineOptions(options);
// KUniqueApplication::addCmdLineOptions();
// if (!KUniqueApplication::start())
// return 0;
QApplication::setColorSpec(QApplication::ManyColor);
// KUniqueApplication app;
KApplication app;
//
MainWindow *widget = new MainWindow();
widget->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() > 0) {
widget->openUrl(args->url(0));
}
args->clear();
QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
int rc = app.exec();
// delete widget;
return rc;
}
示例15: handleURLArgs
void KopeteApplication::handleURLArgs()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
// kdDebug(14000) << k_funcinfo << "called with " << args->count() << " arguments to handle." << endl;
if ( args->count() > 0 )
{
for ( int i = 0; i < args->count(); i++ )
{
KURL u( args->url( i ) );
if ( !u.isValid() )
continue;
Kopete::MimeTypeHandler::dispatchURL( u );
} // END for()
} // END args->count() > 0
}