本文整理汇总了C++中kurl::List::toStringList方法的典型用法代码示例。如果您正苦于以下问题:C++ List::toStringList方法的具体用法?C++ List::toStringList怎么用?C++ List::toStringList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kurl::List
的用法示例。
在下文中一共展示了List::toStringList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testMostLocalUrlList
void KUrlMimeTest::testMostLocalUrlList()
{
QMimeData* mimeData = new QMimeData;
KUrl::List urls;
urls.append(KUrl("desktop:/foo"));
urls.append(KUrl("desktop:/bar"));
KUrl::List localUrls;
localUrls.append(KUrl("file:/home/dfaure/Desktop/foo"));
localUrls.append(KUrl("file:/home/dfaure/Desktop/bar"));
urls.populateMimeData(localUrls, mimeData);
QVERIFY(KUrl::List::canDecode(mimeData));
QVERIFY(mimeData->hasUrls());
QVERIFY(mimeData->hasText());
QVERIFY(mimeData->hasFormat("text/plain"));
// KUrl decodes the real "kde" urls by default
KUrl::List decodedURLs = KUrl::List::fromMimeData(mimeData);
QVERIFY(!decodedURLs.isEmpty());
QCOMPARE(decodedURLs.toStringList().join(" "), urls.toStringList().join(" ") );
// KUrl can also be told to decode the "most local" urls
decodedURLs = KUrl::List::fromMimeData(mimeData, 0, KUrl::List::PreferLocalUrls);
QVERIFY(!decodedURLs.isEmpty());
QCOMPARE(decodedURLs.toStringList().join(" "), localUrls.toStringList().join(" ") );
// QMimeData decodes the "most local" urls
const QList<QUrl> qurls = mimeData->urls();
QCOMPARE(qurls.count(), localUrls.count());
for (int i = 0; i < qurls.count(); ++i )
QCOMPARE(qurls[i], static_cast<QUrl>(localUrls[i]));
}
示例2: checkPDE
void checkPDE(const KService &service, const KURL::List &urls, bool hs, bool tf, QString b)
{
check(QString().sprintf("processDesktopExec( "
"service = {\nexec = %s\nterminal = %s, terminalOptions = %s\nsubstituteUid = %s, user = %s },"
"\nURLs = { %s },\nhas_shell = %s, temp_files = %s )",
service.exec().latin1(), bt(service.terminal()), service.terminalOptions().latin1(), bt(service.substituteUid()),
service.username().latin1(), KShell::joinArgs(urls.toStringList()).latin1(), bt(hs), bt(tf)),
KShell::joinArgs(KRun::processDesktopExec(service, urls, hs, tf)), b);
}
示例3: testURLList
void KUrlMimeTest::testURLList()
{
QMimeData* mimeData = new QMimeData;
QVERIFY( !KUrl::List::canDecode( mimeData ) );
QVERIFY(!mimeData->hasUrls());
KUrl::List urls;
urls.append( KUrl( "http://www.kde.org" ) );
urls.append( KUrl( "http://wstephenson:[email protected]/path" ) );
urls.append( KUrl( "file:///home/dfaure/konqtests/Mat%C3%A9riel" ) );
QMap<QString, QString> metaData;
metaData["key"] = "value";
metaData["key2"] = "value2";
urls.populateMimeData( mimeData, metaData );
QVERIFY(KUrl::List::canDecode( mimeData ));
QVERIFY(mimeData->hasUrls());
QVERIFY(mimeData->hasText());
QMap<QString, QString> decodedMetaData;
KUrl::List decodedURLs = KUrl::List::fromMimeData( mimeData, &decodedMetaData );
QVERIFY( !decodedURLs.isEmpty() );
KUrl::List expectedUrls = urls;
expectedUrls[1] = KUrl("http://[email protected]/path"); // password removed
QCOMPARE( expectedUrls.toStringList().join(" "), decodedURLs.toStringList().join(" ") );
const QList<QUrl> qurls = mimeData->urls();
QCOMPARE(qurls.count(), urls.count());
for (int i = 0; i < qurls.count(); ++i )
QCOMPARE(qurls[i], static_cast<QUrl>(decodedURLs[i]));
QVERIFY( !decodedMetaData.isEmpty() );
QCOMPARE( decodedMetaData["key"], QString( "value" ) );
QCOMPARE( decodedMetaData["key2"], QString( "value2" ) );
delete mimeData;
}
示例4: remove
DvcsJob::JobStatus GitRunner::remove(const KUrl::List &files)
{
if (files.empty())
return m_jobStatus = DvcsJob::JobCancelled;
DvcsJob *job = new DvcsJob();
initJob(*job);
*job << "rm";
QStringList stringFiles = files.toStringList();
while (!stringFiles.isEmpty()) {
*job << m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0);
}
startJob(*job);
return m_jobStatus;
}
示例5: add
void GitRunner::add(const KUrl::List &localLocations)
{
if (localLocations.empty()) {
return;
}
QStringList command;
command << "add";
// Adding files to the runner.
QStringList stringFiles = localLocations.toStringList();
while (!stringFiles.isEmpty()) {
command.append(m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0));
}
execSynchronously(command);
}
示例6: add
DvcsJob::JobStatus GitRunner::add(const KUrl::List &localLocations)
{
if (localLocations.empty())
return m_jobStatus = DvcsJob::JobCancelled;
DvcsJob *job = new DvcsJob();
initJob(*job);
*job << "add";
// Adding files to the runner.
QStringList stringFiles = localLocations.toStringList();
while (!stringFiles.isEmpty()) {
*job << m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0);
}
startJob(*job);
return m_jobStatus;
}
示例7: remove
void GitRunner::remove(const KUrl::List &files)
{
if (files.empty()) {
return;
}
QStringList command;
command << "rm ";
QStringList stringFiles = files.toStringList();
while (!stringFiles.isEmpty()) {
command.append(m_lastRepoRoot->pathOrUrl() + '/' + stringFiles.takeAt(0));
}
KJob *job = initJob(command);
connect(job, SIGNAL(result(KJob*)), this, SLOT(handleRemove(KJob*)));
job->start();
}
示例8: slotPrint
//.........这里部分代码省略.........
else if(job_mode == "none")
job_output = 2;
else
job_output = 0;
// some checking
if(files.count() > 0)
{
check_stdin = false;
if(force_stdin)
{
showmsg(i18n("A file has been specified on the command line. Printing from STDIN will be disabled."), 1);
force_stdin = false;
}
}
if(nodialog && files.count() == 0 && !force_stdin && !check_stdin)
{
errormsg(i18n("When using '--nodialog', you must at least specify one file to print or use the '--stdin' flag."));
}
if(check_stdin)
{ // check if there's any input on stdin
fd_set in;
struct timeval tm;
tm.tv_sec = 0;
tm.tv_usec = 0;
FD_ZERO(&in);
FD_SET(0, &in);
if(select(1, &in, NULL, NULL, &tm))
{ // we have data on stdin
if(read(0, &readchar, 1) > 0)
{
force_stdin = true;
check_stdin = false;
dataread = true;
kdDebug(500) << "input detected on stdin" << endl;
}
else
{
force_stdin = check_stdin = false;
kdDebug(500) << "stdin closed and empty" << endl;
}
}
else
kdDebug(500) << "no input on stdin at startup" << endl;
}
// force_stdin ? or also check_stdin ?
KPrinter::ApplicationType dialog_mode = (force_stdin || nodialog ? KPrinter::StandAlone : KPrinter::StandAlonePersistent);
KPrinter::setApplicationType(dialog_mode);
if(!force_stdin)
KPrinter::addStandardPage(KPrinter::FilesPage);
KPrinter kprinter;
if(nodialog)
{
KMPrinter *prt(0);
KMManager *mgr = KMManager::self();
mgr->printerList(false);
if(!printer.isEmpty())
prt = mgr->findPrinter(printer);
else
prt = mgr->defaultPrinter();
if(prt == 0)
errormsg(i18n("The specified printer or the default printer could not be found."));
else if(!prt->autoConfigure(&kprinter))
errormsg(i18n("Operation aborted."));
}
else if(!printer.isEmpty())
kprinter.setSearchName(printer);
kprinter.setDocName(title);
kprinter.initOptions(opts);
kprinter.setOption("kde-filelist", files.toStringList().join("@@"));
kdDebug(500) << kprinter.option("kde-filelist") << endl;
if(ncopies > 0)
kprinter.setNumCopies(ncopies);
if(nodialog)
slotPrintRequested(&kprinter);
else
{
dlg = KPrintDialog::printerDialog(&kprinter, 0);
if(dlg)
{
connect(dlg, SIGNAL(printRequested(KPrinter *)), SLOT(slotPrintRequested(KPrinter *)));
if(check_stdin)
{
notif = new QSocketNotifier(0, QSocketNotifier::Read, this);
connect(notif, SIGNAL(activated(int)), this, SLOT(slotGotStdin()));
kdDebug(500) << "waiting for input on stdin" << endl;
}
dlg->exec();
delete dlg;
}
else
errormsg(i18n("Unable to construct the print dialog."));
}
示例9: main
int main( int argc, char** argv ) {
KAboutData aboutData( "test_cryptoconfig", 0, ki18n("CryptoConfig Test"), "0.1" );
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app( false );
Kleo::CryptoConfig * config = new QGpgMECryptoConfig();
// Dynamic querying of the options
cout << "Components:" << endl;
QStringList components = config->componentList();
for( QStringList::Iterator compit = components.begin(); compit != components.end(); ++compit ) {
cout << "Component " << (*compit).toLocal8Bit().constData() << ":" << endl;
const Kleo::CryptoConfigComponent* comp = config->component( *compit );
assert( comp );
QStringList groups = comp->groupList();
for( QStringList::Iterator groupit = groups.begin(); groupit != groups.end(); ++groupit ) {
const Kleo::CryptoConfigGroup* group = comp->group( *groupit );
assert( group );
cout << " Group " << (*groupit).toLocal8Bit().constData() << ": descr=\"" << group->description().toLocal8Bit().constData() << "\""
<< " level=" << group->level() << endl;
QStringList entries = group->entryList();
for( QStringList::Iterator entryit = entries.begin(); entryit != entries.end(); ++entryit ) {
const Kleo::CryptoConfigEntry* entry = group->entry( *entryit );
assert( entry );
cout << " Entry " << (*entryit).toLocal8Bit().constData() << ":"
<< " descr=\"" << entry->description().toLocal8Bit().constData() << "\""
<< " " << ( entry->isSet() ? "is set" : "is not set" );
if ( !entry->isList() )
switch( entry->argType() ) {
case Kleo::CryptoConfigEntry::ArgType_None:
break;
case Kleo::CryptoConfigEntry::ArgType_Int:
cout << " int value=" << entry->intValue();
break;
case Kleo::CryptoConfigEntry::ArgType_UInt:
cout << " uint value=" << entry->uintValue();
break;
case Kleo::CryptoConfigEntry::ArgType_LDAPURL:
case Kleo::CryptoConfigEntry::ArgType_URL:
cout << " URL value=" << entry->urlValue().prettyUrl().toLocal8Bit().constData();
// fallthrough
case Kleo::CryptoConfigEntry::ArgType_Path:
// fallthrough
case Kleo::CryptoConfigEntry::ArgType_DirPath:
// fallthrough
case Kleo::CryptoConfigEntry::ArgType_String:
cout << " string value=" << entry->stringValue().toLocal8Bit().constData();
break;
case Kleo::CryptoConfigEntry::NumArgType:
// just metadata and should never actually occur in the switch
break;
}
else // lists
{
switch( entry->argType() ) {
case Kleo::CryptoConfigEntry::ArgType_None: {
cout << " set " << entry->numberOfTimesSet() << " times";
break;
}
case Kleo::CryptoConfigEntry::ArgType_Int: {
assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
Q3ValueList<int> lst = entry->intValueList();
QString str;
for( Q3ValueList<int>::Iterator it = lst.begin(); it != lst.end(); ++it ) {
str += QString::number( *it );
}
cout << " int values=" << str.toLocal8Bit().constData();
break;
}
case Kleo::CryptoConfigEntry::ArgType_UInt: {
assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
Q3ValueList<uint> lst = entry->uintValueList();
QString str;
for( Q3ValueList<uint>::Iterator it = lst.begin(); it != lst.end(); ++it ) {
str += QString::number( *it );
}
cout << " uint values=" << str.toLocal8Bit().constData();
break;
}
case Kleo::CryptoConfigEntry::ArgType_LDAPURL:
case Kleo::CryptoConfigEntry::ArgType_URL: {
assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
KUrl::List urls = entry->urlValueList();
cout << " url values=" << urls.toStringList().join(" ").toLocal8Bit().constData() << "\n ";
}
// fallthrough
case Kleo::CryptoConfigEntry::ArgType_Path:
// fallthrough
case Kleo::CryptoConfigEntry::ArgType_DirPath:
// fallthrough
case Kleo::CryptoConfigEntry::ArgType_String: {
assert( entry->isOptional() ); // empty lists must be allowed (see issue121)
QStringList lst = entry->stringValueList();
cout << " string values=" << lst.join(" ").toLocal8Bit().constData();
break;
}
case Kleo::CryptoConfigEntry::NumArgType:
//.........这里部分代码省略.........