当前位置: 首页>>代码示例>>C++>>正文


C++ KUrl::setFileName方法代码示例

本文整理汇总了C++中KUrl::setFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ KUrl::setFileName方法的具体用法?C++ KUrl::setFileName怎么用?C++ KUrl::setFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KUrl的用法示例。


在下文中一共展示了KUrl::setFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: findUrlForAccount

 static KUrl findUrlForAccount( const KMail::ImapAccountBase * a ) {
   assert( a );
   const SieveConfig sieve = a->sieveConfig();
   if ( !sieve.managesieveSupported() )
     return KUrl();
   if ( sieve.reuseConfig() ) {
     // assemble Sieve url from the settings of the account:
     KUrl u;
     u.setProtocol( "sieve" );
     u.setHost( a->host() );
     u.setUser( a->login() );
     u.setPass( a->passwd() );
     u.setPort( sieve.port() );
     u.addQueryItem( "x-mech", a->auth() == "*" ? "PLAIN" : a->auth() ); //translate IMAP LOGIN to PLAIN
     if ( !a->useSSL() && !a->useTLS() )
       u.addQueryItem( "x-allow-unencrypted", "true" );
     u.setFileName( sieve.vacationFileName() );
     return u;
   } else {
     KUrl u = sieve.alternateURL();
     if ( u.protocol().toLower() == "sieve" && !a->useSSL() && !a->useTLS() && u.queryItem("x-allow-unencrypted").isEmpty() )
       u.addQueryItem( "x-allow-unencrypted", "true" );
     u.setFileName( sieve.vacationFileName() );
     return u;
   }
 }
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:26,代码来源:vacation.cpp

示例2: slotUrlsDropped

void ScanGallery::slotUrlsDropped(QDropEvent *ev, FileTreeViewItem *item)
{
    KUrl::List urls = ev->mimeData()->urls();
    if (urls.isEmpty()) return;

    kDebug() << "onto" << (item==NULL ? "NULL" : item->url().prettyUrl())
             << "srcs" << urls.count() << "first" << urls.first();
    
    if (item==NULL) return;
    KUrl dest = item->url();

    // Check whether the drop is on top of a directory (in which case we
    // want to move/copy into it) or a file (move/copy into its containing
    // directory).
    if (!item->isDir()) dest.setFileName(QString::null);
    dest.adjustPath(KUrl::AddTrailingSlash);
    kDebug() << "resolved destination" << dest;

    // Make the last URL to copy the one to select next
    KUrl nextSel = dest;
    nextSel.addPath(urls.back().fileName(KUrl::ObeyTrailingSlash));
    m_nextUrlToShow = nextSel;

    KIO::Job *job;
    // TODO: top level window as 3rd parameter?
    if (ev->dropAction()==Qt::MoveAction) job = KIO::move(urls, dest);
    else job = KIO::copy(urls, dest);
    connect(job, SIGNAL(result(KJob *)), SLOT(slotJobResult(KJob *)));
}
开发者ID:KDE,项目名称:kooka,代码行数:29,代码来源:scangallery.cpp

示例3: file

bool
M3UPlaylist::save( const KUrl &location, bool relative )
{
    KUrl savePath = location;
    //if the location is a directory append the name of this playlist.
    if( savePath.fileName().isNull() )
        savePath.setFileName( name() );

    QFile file( savePath.path() );

    if( !file.open( QIODevice::WriteOnly ) )
    {
        error() << "Unable to write to playlist " << savePath.path();
        return false;
    }

    QTextStream stream( &file );

    stream << "#EXTM3U\n";

    KUrl::List urls;
    QStringList titles;
    QList<int> lengths;
    foreach( Meta::TrackPtr track, m_tracks )
    {
        Q_ASSERT(track);

        const KUrl &url = track->playableUrl();
        int length = track->length() / 1000;
        const QString &title = track->name();
        const QString &artist = track->artist()->name();

        if( !title.isEmpty() && !artist.isEmpty() && length )
        {
            stream << "#EXTINF:";
            stream << QString::number( length );
            stream << ',';
            stream << artist << " - " << title;
            stream << '\n';
        }
        if( url.protocol() == "file" )
        {
            if( relative )
            {
                const QFileInfo fi( file );
                QString relativePath = KUrl::relativePath( fi.path(), url.path() );
                relativePath.remove( 0, 2 ); //remove "./"
                stream << relativePath;
            }
            else
            {
                stream << url.path();
            }
        }
        else
        {
            stream << url.url();
        }
        stream << "\n";
    }
开发者ID:saurabhsood91,项目名称:Amarok,代码行数:60,代码来源:M3UPlaylist.cpp

示例4: generateXhtmlForProject

/**
 * Exports the current model to XHTML in a directory named as the model
 * with the .xmi suffix removed. The XHTML file will have the same name
 * with the .html suffix. Figures will be named as the corresponding
 * diagrams in the GUI
 * @todo change file naming to avoid paths with spaces or non-ASCII chars
 * @todo better handling of error conditions
 * @return true if saving is successful and false otherwise.
 */
bool XhtmlGenerator::generateXhtmlForProject()
{
    KUrl url = m_umlDoc->url();
    QString fileName = url.fileName();
    fileName.remove(QRegExp(".xmi$"));
    url.setFileName(fileName);
    uDebug() << "Exporting to directory: " << url;
    return generateXhtmlForProjectInto(url);
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:18,代码来源:xhtmlgenerator.cpp

示例5: updateUrl

void KexiProjectTitleSelectionPage::updateUrl()
{
    KUrl url = contents->file_requester->url();
    QString fn = KexiDB::string2FileName(contents->le_title->text());
    if (!fn.isEmpty() && !fn.endsWith(".kexi"))
        fn += ".kexi";
    url.setFileName(fn);
    contents->file_requester->setUrl(url);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:9,代码来源:KexiNewProjectAssistant.cpp

示例6: generateDocbookForProject

/**
 * Exports the current model to docbook in a directory named as the model
 * with the .xmi suffix removed. The docbook file will have the same name
 * with the .docbook suffix. Figures will be named as the corresponding
 * diagrams in the GUI
 * @todo change file naming to avoid paths with spaces or non-ASCII chars
 * @todo better handling of error conditions
 * @return true if saving is successful and false otherwise.
 */
bool DocbookGenerator::generateDocbookForProject()
{
  KUrl url = umlDoc->url();
  QString fileName = url.fileName();
  fileName.remove(QRegExp(".xmi$"));
  url.setFileName(fileName);
  uDebug() << "Exporting to directory: " << url;
  generateDocbookForProjectInto(url);
  return true;
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:19,代码来源:docbookgenerator.cpp

示例7: isValidDirectory

bool CvsProxy::isValidDirectory(KUrl dirPath) const
{
    QFileInfo fsObject( dirPath.toLocalFile() );
    if( !fsObject.isDir() )
        dirPath.setFileName( QString() );

    dirPath.addPath( "CVS" );
    fsObject.setFile( dirPath.toLocalFile() );
    return fsObject.exists();
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:10,代码来源:cvsproxy.cpp

示例8: changeExtension

KUrl OutputDirectory::changeExtension( const KUrl& url, const QString& extension )
{
    KUrl newUrl = url;

    QString fileName = newUrl.fileName();
    fileName = newUrl.fileName().left( newUrl.fileName().lastIndexOf(".")+1 ) + extension;

    newUrl.setFileName( fileName );

    return newUrl;
}
开发者ID:unwork-inc,项目名称:soundkonverter,代码行数:11,代码来源:outputdirectory.cpp

示例9: itemDirectory

/* The absolute URL of the item (if it is a directory), or its parent (if
   it is a file).
*/
KUrl ScanGallery::itemDirectory(const FileTreeViewItem *item) const
{
    if (item==NULL)
    {
        kDebug() << "no item";
        return (KUrl());
    }

    KUrl u = item->url();
    if (!item->isDir()) u.setFileName("");		// not a directory, remove file name
    else u.adjustPath(KUrl::AddTrailingSlash);		// is a directory, ensure ends with "/"
    return (u);
}
开发者ID:KDE,项目名称:kooka,代码行数:16,代码来源:scangallery.cpp

示例10: uniqueFileName

KUrl OutputDirectory::uniqueFileName( const KUrl& url, const QStringList& usedOutputNames )
{
    KUrl uniqueUrl = url;

    while( QFile::exists(uniqueUrl.toLocalFile()) || usedOutputNames.contains(uniqueUrl.toLocalFile()) )
    {
        QString fileName = uniqueUrl.fileName();
        fileName = fileName.left( fileName.lastIndexOf(".")+1 ) + i18nc("will be appended to the filename if a file with the same name already exists","new") + fileName.mid( fileName.lastIndexOf(".") );
        uniqueUrl.setFileName( fileName );
    }

    return uniqueUrl;
}
开发者ID:unwork-inc,项目名称:soundkonverter,代码行数:13,代码来源:outputdirectory.cpp

示例11: saveRecentDir

void KexiStartupFileHandler::saveRecentDir()
{
    if (!d->recentDirClass.isEmpty()) {
        kDebug() << d->recentDirClass;
        
        KUrl dirUrl;
        if (d->requester)
            dirUrl = d->requester->url();
        else if (d->dialog)
            dirUrl = d->dialog->selectedUrl();
        kDebug() << dirUrl;
        if (dirUrl.isValid() && dirUrl.isLocalFile()) {
            dirUrl.setFileName(QString());
            kDebug() << "Added" << dirUrl.url() << "to recent dirs class" << d->recentDirClass;
            KRecentDirs::add(d->recentDirClass, dirUrl.url());
        }
    }
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:18,代码来源:KexiStartupFileHandler.cpp

示例12: if

KUrl Kopete::Transfer::displayURL( const Kopete::Contact *contact, const QString &file )
{
	KUrl url;
	url.setProtocol( QString::fromLatin1("kopete") );

	QString host;
	if( !contact )
		host = QString::fromLatin1("unknown origin");
	else if( contact->metaContact() )
		host = contact->metaContact()->displayName();
	else
		host = contact->contactId();
	url.setHost(host);

	// url.setPath( contact->protocol()->displayName() );

	url.setFileName( file );
	return url;
}
开发者ID:Jtalk,项目名称:kopete-fork-xep0136,代码行数:19,代码来源:kopetetransfermanager.cpp

示例13: slotCreateFolder

/* ----------------------------------------------------------------------- */
void ScanGallery::slotCreateFolder( )
{
   bool ok;
   QString folder = KInputDialog::getText( i18n( "New Folder" ),
         i18n( "Name for the new folder:" ), QString::null,
         &ok, this );

   if( ok )
   {
	 /* KIO create folder goes here */

	 FileTreeViewItem *it = highlightedFileTreeViewItem();
	 if( it )
	 {
	    KUrl url = it->url();

	    /* If a directory is selected, the filename needs not to be deleted */
	    if( ! it->isDir())
	       url.setFileName( "" );
	    /* add the folder name from user input */
	    url.addPath( folder );
	    kDebug() << "Creating folder" << url;

	    /* Since the new directory arrives in the packager in the newItems-slot, we set a
	     * variable urlToSelectOnArrive here. The newItems-slot will honor it and select
	     * the treeviewitem with that url.
	     */
	    slotSetNextUrlToSelect( url );

	    if( ! KIO::NetAccess::mkdir( url, 0, -1 ))
	    {
	       kDebug() << "Error: creation of" << url << "failed!";
	    }
	    else
	    {
	       /* created successfully */
	       /* open the branch if necessary and select the new folder */

	    }
	 }
   }
}
开发者ID:KDE,项目名称:kooka,代码行数:43,代码来源:scangallery.cpp

示例14: isVersionControlled

bool CvsProxy::isVersionControlled(KUrl filePath) const
{
    QFileInfo fsObject( filePath.toLocalFile() );
    if( !fsObject.isDir() )
        filePath.setFileName( QString() );

    filePath.addPath( "CVS" );
    QFileInfo cvsObject( filePath.toLocalFile() );
    if( !cvsObject.exists() )
        return false;

    if( fsObject.isDir() )
        return true;

    filePath.addPath( "Entries" );
    QFile cvsEntries( filePath.toLocalFile() );
    cvsEntries.open( QIODevice::ReadOnly );
    QString cvsEntriesData = cvsEntries.readAll();
    cvsEntries.close();
    return ( cvsEntriesData.indexOf( fsObject.fileName() ) != -1 );
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:21,代码来源:cvsproxy.cpp

示例15: internalName

QString Theme::internalName() const {
	KUrl url = d->mUrl;
	url.setFileName("");
	return url.fileName();
}
开发者ID:UIKit0,项目名称:digikam,代码行数:5,代码来源:theme.cpp


注:本文中的KUrl::setFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。