本文整理汇总了C++中QStrList::first方法的典型用法代码示例。如果您正苦于以下问题:C++ QStrList::first方法的具体用法?C++ QStrList::first怎么用?C++ QStrList::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStrList
的用法示例。
在下文中一共展示了QStrList::first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotCopyClients
void KFMServer::slotCopyClients( const char *_src_urls, const char *_dest_url )
{
QString s = _src_urls;
s.detach();
QStrList urlList;
QString dest = _dest_url;
if ( dest == "trash:/" )
dest = "file:" + KFMPaths::TrashPath();
int i;
while ( ( i = s.find( "\n" ) ) != -1 )
{
QString t = s.left( i );
urlList.append( t.data() );
s = s.mid( i + 1, s.length() );
}
urlList.append( s.data() );
KIOJob *job = new KIOJob();
if ( urlList.count() == 1 )
job->copy( urlList.first(), dest.data() );
else
job->copy( urlList, dest.data() );
}
示例2: writeListConf
void writeListConf ( KConfig *conf, QString key, QStrList &list )
{
if( list.isEmpty() )
{
conf->writeEntry(key, "");
return;
}
QString str_list;
QString value;
int i;
for( value = list.first(); value != ""; value = list.next() )
{
for( i = 0; i < (int) value.length(); i++ )
{
switch( value[i] ) {
case ',':
str_list += '\\';
break;
case '\\':
str_list += '\\';
break;
//defaults:
//;
};
str_list += value[i];
}
str_list += ',';
}
if( str_list.right(1) == "," )
str_list.truncate(str_list.length()-1);
conf->writeEntry(key, str_list);
}
示例3: saveGroup
void
KAMenu::slotHostlistChanged()
{
/* die Liste der erreichbaren Archiehosts hat sich
* veraendert. neu einlesen
*/
// KConfig *config = KApplication::getKApplication()->getConfig();
QStrList archiehostlist;
// int archiehostlistnumber =
KConfigGroupSaver saveGroup( config, "HostConfig" );
config->readListEntry( "Hosts", archiehostlist );
// QString currenthost = config->readEntry( "CurrentHost", "archie.sura.net" );
QString defaulthost = "archie.sura.net" ;
if ( archiehostlist.isEmpty() ) {
archiehostlist.append( defaulthost );
// currentHostId = 0;
}
host->clear();
char *tmpStr;
int i = 0;
for (tmpStr=archiehostlist.first(); tmpStr; tmpStr=archiehostlist.next()) {
host->insertItem( tmpStr, i, i);
i++;
}
slotConfigChanged();
emit sigArchieHost(host->text(host_id));
}
示例4: addPath
KIconLoader::KIconLoader( KConfig *conf,
const QString &app_name, const QString &var_name ){
QStrList list;
config = conf;
config->setGroup(app_name);
config->readListEntry( var_name, list, ':' );
for (const char *it=list.first(); it; it = list.next())
addPath(it);
initPath();
name_list.setAutoDelete(TRUE);
pixmap_dirs.setAutoDelete(TRUE);
pixmap_list.setAutoDelete(TRUE);
/*
for(char* c = pixmap_dirs.first(); c ; c = pixmap_dirs.next()){
printf("in path:%s\n",pixmap_dirs.current());
}
*/
}
示例5: slotMove
void KFMClient::slotMove( const char *_src_urls, const char *_dest_url )
{
QString s = _src_urls;
s.detach();
QStrList urlList;
QString dest = _dest_url;
if ( dest == "trash:/" )
dest = "file:" + KFMPaths::TrashPath();
int i;
while ( ( i = s.find( "\n" ) ) != -1 )
{
QString t = s.left( i );
urlList.append( t.data() );
s = s.mid( i + 1, s.length() );
}
urlList.append( s.data() );
KIOJob *job = new KIOJob();
connect( job, SIGNAL( finished( int ) ), this, SLOT( finished( int ) ) );
if ( urlList.count() == 1 )
job->move( urlList.first(), dest.data() );
else
job->move( urlList, dest.data() );
}
示例6: onDrop
void KMix::onDrop( KDNDDropZone* _zone )
{
QStrList strlist;
KURL *url;
strlist = _zone->getURLList();
url = new KURL( strlist.first() );
delete url;
}
示例7: matchExcludedSymbols
static bool matchExcludedSymbols(const char *name)
{
static QStrList exclSyms;
if (exclSyms.count()==0) return FALSE; // nothing specified
const char *pat = exclSyms.first();
QCString symName = name;
while (pat)
{
QCString pattern = pat;
bool forceStart=FALSE;
bool forceEnd=FALSE;
if (pattern.at(0)=='^')
pattern=pattern.mid(1),forceStart=TRUE;
if (pattern.at(pattern.length()-1)=='$')
pattern=pattern.left(pattern.length()-1),forceEnd=TRUE;
if (pattern.find('*')!=-1) // wildcard mode
{
QRegExp re(substitute(pattern,"*",".*"),TRUE);
int i,pl;
i = re.match(symName,0,&pl);
//printf(" %d = re.match(%s) pattern=%s\n",i,symName.data(),pattern.data());
if (i!=-1) // wildcard match
{
int sl=symName.length();
// check if it is a whole word match
if ((i==0 || pattern.at(0)=='*' || (!isId(symName.at(i-1)) && !forceStart)) &&
(i+pl==sl || pattern.at(i+pl)=='*' || (!isId(symName.at(i+pl)) && !forceEnd))
)
{
//printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i);
return TRUE;
}
}
}
else if (!pattern.isEmpty()) // match words
{
int i = symName.find(pattern);
if (i!=-1) // we have a match!
{
int pl=pattern.length();
int sl=symName.length();
// check if it is a whole word match
if ((i==0 || (!isId(symName.at(i-1)) && !forceStart)) &&
(i+pl==sl || (!isId(symName.at(i+pl)) && !forceEnd))
)
{
//printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i);
return TRUE;
}
}
}
pat = exclSyms.next();
}
//printf("--> name=%s: no match\n",name);
return FALSE;
}
示例8: decodeToUnicodeUris
/*!
Decodes URIs from \a e, converts them to Unicode URIs (only useful for
displaying to humans),
placing them in \a l (which is first cleared).
Returns TRUE if the event contained a valid list of URIs.
*/
bool QUriDrag::decodeToUnicodeUris( const QMimeSource* e, QStringList& l )
{
QStrList u;
if ( !decode( e, u ) )
return FALSE;
l.clear();
for (const char* s=u.first(); s; s=u.next())
l.append( uriToUnicodeUri(s) );
return TRUE;
}
示例9: slotBookmarks
void KfmView::slotBookmarks()
{
char *s;
QStrList popupFiles = new QStrList();
getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
if ( popupFiles.isEmpty() && popupMenuEvent )
{
popupFiles.append ( getURL() );
}
for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )
gui->addBookmark( s, s );
}
示例10: setUrls
/*!
Changes the list of \a urls to be dragged.
*/
void QUrlDrag::setUrls( QStrList urls )
{
QByteArray a;
int c=0;
for (const char* s = urls.first(); s; s = urls.next() ) {
int l = strlen(s)+1;
a.resize(c+l);
memcpy(a.data()+c,s,l);
c+=l;
}
a.resize(c-1); // chop off last nul
setEncodedData(a);
}
示例11: canDecode
/*!
Returns TRUE if the information in \a e can be decoded into an image.
\sa decode()
*/
bool QImageDrag::canDecode( const QMimeSource* e )
{
QStrList fileFormats = QImageIO::inputFormats();
fileFormats.first();
while ( fileFormats.current() ) {
QCString format = fileFormats.current();
QCString type = "image/" + format.lower();
if ( e->provides( type.data() ) )
return TRUE;
fileFormats.next();
}
return FALSE;
}
示例12: setUris
/*!
Changes the list of \a uris to be dragged.
*/
void QUriDrag::setUris( QStrList uris )
{
QByteArray a;
int c=0;
for ( const char* s = uris.first(); s; s = uris.next() ) {
int l = qstrlen(s);
a.resize(c+l+2);
memcpy(a.data()+c,s,l);
memcpy(a.data()+c+l,"\r\n",2);
c+=l+2;
}
setEncodedData(a);
}
示例13: slotNewView
void KfmView::slotNewView()
{
char *s;
QStrList popupFiles = new QStrList();
getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
if ( popupFiles.isEmpty() && popupMenuEvent )
popupFiles.append ( getURL() );
for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )
{
KfmGui *m = new KfmGui( 0L, 0L, s );
m->show();
}
}
示例14: startJobSmtp
void KNNetAccess::startJobSmtp()
{
if(smtpJobQueue.isEmpty())
return;
currentSmtpJob = smtpJobQueue.first();
smtpJobQueue.remove(smtpJobQueue.begin());
currentSmtpJob->prepareForExecution();
if(currentSmtpJob->success())
{
KNLocalArticle *art = static_cast<KNLocalArticle *>(currentSmtpJob->data());
// create url query part
QString query("headers=0&from=");
query += KURL::encode_string(art->from()->email());
QStrList emails;
art->to()->emails(&emails);
for(char *e = emails.first(); e; e = emails.next())
{
query += "&to=" + KURL::encode_string(e);
}
// create url
KURL destination;
KNServerInfo *account = currentSmtpJob->account();
if(account->encryption() == KNServerInfo::SSL)
destination.setProtocol("smtps");
else
destination.setProtocol("smtp");
destination.setHost(account->server());
destination.setPort(account->port());
destination.setQuery(query);
if(account->needsLogon())
{
destination.setUser(account->user());
destination.setPass(account->pass());
}
KIO::Job *job = KIO::storedPut(art->encodedContent(true), destination, -1, false, false, false);
connect(job, SIGNAL(result(KIO::Job *)),
SLOT(slotJobResult(KIO::Job *)));
if(account->encryption() == KNServerInfo::TLS)
job->addMetaData("tls", "on");
else
job->addMetaData("tls", "off");
currentSmtpJob->setJob(job);
kdDebug(5003) << "KNNetAccess::startJobSmtp(): job started" << endl;
}
else
{
threadDoneSmtp();
}
}
示例15: decodeLocalFiles
/*!
Decodes URIs from \a e, converts them to local files if they refer to
local files, and places them in \a l (which is first cleared).
Returns TRUE if the event contained a valid list of URIs.
The list will be empty if no URIs were local files.
*/
bool QUriDrag::decodeLocalFiles( const QMimeSource* e, QStringList& l )
{
QStrList u;
if ( !decode( e, u ) )
return FALSE;
l.clear();
for (const char* s=u.first(); s; s=u.next()) {
QString lf = uriToLocalFile(s);
if ( !lf.isNull() )
l.append( lf );
}
return TRUE;
}