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


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

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


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

示例1:

QString KUrlNavigator::Private::firstButtonText() const
{
    QString text;

    // The first URL navigator button should get the name of the
    // place instead of the directory name
    if ((m_placesSelector != 0) && !m_showFullPath) {
        const KUrl placeUrl = m_placesSelector->selectedPlaceUrl();
        text = m_placesSelector->selectedPlaceText();
    }

    if (text.isEmpty()) {
        const KUrl currentUrl = q->locationUrl();
        if (currentUrl.isLocalFile()) {
            text = m_showFullPath ? QLatin1String("/") : i18n("Custom Path");
        } else {
            text = currentUrl.protocol() + QLatin1Char(':');
            if (!currentUrl.host().isEmpty()) {
                text += QLatin1Char(' ') + currentUrl.host();
            }
        }
    }

    return text;
}
开发者ID:fluxer,项目名称:kdelibs,代码行数:25,代码来源:kurlnavigator.cpp

示例2: values

QVariantHash ChooseSamba::values() const
{
    QVariantHash ret = m_args;

    QString address = ui->addressLE->text().trimmed();
    KUrl url;
    if (address.startsWith(QLatin1String("//"))) {
        url = QLatin1String("smb:") % address;
    } else if (address.startsWith(QLatin1String("/"))) {
        url = QLatin1String("smb:/") % address;
    } else if (address.startsWith(QLatin1String("://"))) {
        url = QLatin1String("smb") % address;
    } else if (address.startsWith(QLatin1String("smb://"))) {
        url = address;
    } else if (!KUrl(address).protocol().isEmpty() &&
               KUrl(address).protocol() != QLatin1String("smb")) {
        url = address;
        url.setProtocol(QLatin1String("smb"));
    } else {
        url = QLatin1String("smb://") % address;
    }

    kDebug() << 1 << url;
    if (!ui->usernameLE->text().isEmpty()) {
        url.setUser(ui->usernameLE->text());
    }

    if (!ui->passwordLE->text().isEmpty()) {
        url.setPass(ui->passwordLE->text());
    }

    kDebug() << 2 << url;
    kDebug() << 3 << url.url() << url.path().section(QLatin1Char('/'), -1, -1);// same as url.fileName()
    kDebug() << 4 << url.fileName();
    kDebug() << 5 << url.host() << url.url().section(QLatin1Char('/'), 3, 3).toLower();

    ret[KCUPS_DEVICE_URI] = url.url();
    ret[KCUPS_DEVICE_INFO] = url.fileName();

    // if there is 4 '/' means the url is like
    // smb://group/host/printer, so the location is at a different place
    if (url.url().count(QLatin1Char('/') == 4)) {
        ret[KCUPS_DEVICE_LOCATION] = url.url().section(QLatin1Char('/'), 3, 3).toLower();
    } else {
        ret[KCUPS_DEVICE_LOCATION] = url.host();
    }

    return ret;
}
开发者ID:freexploit,项目名称:print-manager,代码行数:49,代码来源:ChooseSamba.cpp

示例3: fileSaveAs

void MainWindow::fileSaveAs()
{
    WebTab *w = currentTab();
    KUrl srcUrl = w->url();
    
    // First, try with suggested file name...
    QString name = w->page()->suggestedFileName();

    // Second, with KUrl fileName...
    if (name.isEmpty())
    {
        name = srcUrl.fileName();
    }
    
    // Last chance...
    if(name.isEmpty())
    {
        name = srcUrl.host() + QString(".html");
    }
    
    const QString destUrl = KFileDialog::getSaveFileName(name, QString(), this);
    if (destUrl.isEmpty()) 
        return;
    
    KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite);
    job->addMetaData("MaxCacheSize", "0");  // Don't store in http cache.
    job->addMetaData("cache", "cache");     // Use entry from cache if available.
    job->uiDelegate()->setAutoErrorHandlingEnabled(true);
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:29,代码来源:mainwindow.cpp

示例4: RemoteView

VncView::VncView(QWidget *parent, const KUrl &url, KConfigGroup configGroup)
        : RemoteView(parent),
        m_initDone(false),
        m_buttonMask(0),
        m_repaint(false),
        m_quitFlag(false),
        m_firstPasswordTry(true),
        m_dontSendClipboard(false),
        m_horizontalFactor(1.0),
        m_verticalFactor(1.0),
        m_forceLocalCursor(false)
{
    m_url = url;
    m_host = url.host();
    m_port = url.port();

    // BlockingQueuedConnection can cause deadlocks when exiting, handled in startQuitting()
    connect(&vncThread, SIGNAL(imageUpdated(int,int,int,int)), this, SLOT(updateImage(int,int,int,int)), Qt::BlockingQueuedConnection);
    connect(&vncThread, SIGNAL(gotCut(QString)), this, SLOT(setCut(QString)), Qt::BlockingQueuedConnection);
    connect(&vncThread, SIGNAL(passwordRequest(bool)), this, SLOT(requestPassword(bool)), Qt::BlockingQueuedConnection);
    connect(&vncThread, SIGNAL(outputErrorMessage(QString)), this, SLOT(outputErrorMessage(QString)));

    m_clipboard = QApplication::clipboard();
    connect(m_clipboard, SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
    
#ifndef QTONLY
    m_hostPreferences = new VncHostPreferences(configGroup, this);
#else
    Q_UNUSED(configGroup);
#endif
}
开发者ID:SmartisanTech,项目名称:Wrench,代码行数:31,代码来源:vncview.cpp

示例5: destMatch

 bool destMatch(const KUrl &url, const QString &protClass, const KUrl &base, const QString &baseClass) const
 {
    if (destProtEqual)
    {
       if ( (url.protocol() != base.protocol()) &&
            (protClass.isEmpty() || baseClass.isEmpty() || protClass != baseClass) )
          return false;
    }
    else if (destProtWildCard)
    {
       if ( !destProt.isEmpty() && !url.protocol().startsWith(destProt) &&
            (protClass.isEmpty() || (protClass != destProt)) )
          return false;
    }
    else
    {
       if ( (url.protocol() != destProt) &&
            (protClass.isEmpty() || (protClass != destProt)) )
          return false;
    }
    if (destHostWildCard)
    {
       if (!destHost.isEmpty() && !url.host().endsWith(destHost))
          return false;
    }
    else if (destHostEqual)
    {
       if (url.host() != base.host())
          return false;
    }
    else
    {
       if (url.host() != destHost)
          return false;
    }
    if (destPathWildCard)
    {
       if (!destPath.isEmpty() && !url.path().startsWith(destPath))
          return false;
    }
    else
    {
       if (url.path() != destPath)
          return false;
    }
    return true;
 }
开发者ID:vasi,项目名称:kdelibs,代码行数:47,代码来源:kauthorized.cpp

示例6: TestLaunchConfiguration

 TestLaunchConfiguration(KUrl script) {
     c = new KConfig();
     cfg = c->group("launch");
     cfg.writeEntry("Server", script.host());
     cfg.writeEntry("Path", script.path());
     cfg.writeEntry("Arguments", script.query());
     KConfigGroup pmCfg = cfg.group("Path Mappings").group("0");
     pmCfg.writeEntry("Remote", KUrl(buildBaseUrl));
     pmCfg.writeEntry("Local", KUrl(QDir::currentPath()));
 }
开发者ID:KDE,项目名称:kdev-crossfire,代码行数:10,代码来源:sessiontest.cpp

示例7: openUrl

bool KRunnerItemHandler::openUrl(const KUrl& url)
{
    QString runner = url.host();
    QString id = url.fragment();
    if (id.startsWith(QLatin1Char('/'))) {
        id = id.remove(0, 1);
    }

    runnerManager()->run(id);
    return true;
}
开发者ID:aarontc,项目名称:kde-workspace,代码行数:11,代码来源:krunnermodel.cpp

示例8: addTransfer

void LinkImporter::addTransfer(QString &link)
{
    KUrl auxUrl;
    
    if (link.contains("://")) {
        auxUrl = KUrl(link);
    } else {
        auxUrl = KUrl(QString("http://") + link);
    }

    if(!link.isEmpty() && auxUrl.isValid() && m_transfers.indexOf(link) < 0 &&
       !auxUrl.scheme().isEmpty() && !auxUrl.host().isEmpty()) {
        m_transfers << link;
    }
}
开发者ID:fluxer,项目名称:kde-extraapps,代码行数:15,代码来源:linkimporter.cpp

示例9: splitURL

// The opposite of parseURL
static QString splitURL( int mRealArgType, const KUrl& url )
{
  if ( mRealArgType == 33 ) { // LDAP server
    // The format is HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
    Q_ASSERT( url.protocol() == "ldap" );
    return urlpart_encode( url.host() ) + ':' +
      ( url.port() != -1 ? QString::number( url.port() ) : QString() ) + ':' + // -1 is used for default ports, omit
      urlpart_encode( url.user() ) + ':' +
      urlpart_encode( url.pass() ) + ':' +
      // KUrl automatically encoded the query (e.g. for spaces inside it),
      // so decode it before writing it out to gpgconf (issue119)
      urlpart_encode( KUrl::fromPercentEncoding( url.query().mid(1).toLatin1() ) );
  }
  return url.path();
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:16,代码来源:qgpgmecryptoconfig.cpp

示例10: baseMatch

 bool baseMatch(const KUrl &url, const QString &protClass) const
 {
    if (baseProtWildCard)
    {
       if ( !baseProt.isEmpty() && !url.protocol().startsWith(baseProt) &&
            (protClass.isEmpty() || (protClass != baseProt)) )
          return false;
    }
    else
    {
       if ( (url.protocol() != baseProt) &&
            (protClass.isEmpty() || (protClass != baseProt)) )
          return false;
    }
    if (baseHostWildCard)
    {
       if (!baseHost.isEmpty() && !url.host().endsWith(baseHost))
          return false;
    }
    else
    {
       if (url.host() != baseHost)
          return false;
    }
    if (basePathWildCard)
    {
       if (!basePath.isEmpty() && !url.path().startsWith(basePath))
          return false;
    }
    else
    {
       if (url.path() != basePath)
          return false;
    }
    return true;
 }
开发者ID:vasi,项目名称:kdelibs,代码行数:36,代码来源:kauthorized.cpp

示例11: flags

Qt::ItemFlags KRunnerModel::flags(const QModelIndex &index) const
{
    Qt::ItemFlags flags = QStandardItemModel::flags(index);

    if (index.isValid()) {
        KUrl url = data(index, CommonModel::Url).toString();
        QString host = url.host();
        if (host != "services") {
            flags &= ~ ( Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled );
        }
    } else {
        flags = 0;
    }

    return flags;
}
开发者ID:aarontc,项目名称:kde-workspace,代码行数:16,代码来源:krunnermodel.cpp

示例12: addUrl

void KonqSidebarTree::addUrl(KonqSidebarTreeTopLevelItem* item, const KUrl & url)
{
    QString path;
    if (item)
        path = item->path();
    else
        path = m_dirtreeDir.dir.path();

    KUrl destUrl;

    if (url.isLocalFile() && url.fileName().endsWith(".desktop"))
    {
        QString filename = findUniqueFilename(path, url.fileName());
        destUrl.setPath(filename);
        KIO::NetAccess::file_copy(url, destUrl, this);
    }
    else
    {
        QString name = url.host();
        if (name.isEmpty())
            name = url.fileName();
        QString filename = findUniqueFilename(path, name);
        destUrl.setPath(filename);

        KDesktopFile desktopFile(filename);
        KConfigGroup cfg = desktopFile.desktopGroup();
        cfg.writeEntry("Encoding", "UTF-8");
        cfg.writeEntry("Type","Link");
        cfg.writeEntry("URL", url.url());
        QString icon = "folder";
        if (!url.isLocalFile())
            icon = KMimeType::favIconForUrl(url);
        if (icon.isEmpty())
            icon = KProtocolInfo::icon( url.protocol() );
        cfg.writeEntry("Icon", icon);
        cfg.writeEntry("Name", name);
        cfg.writeEntry("Open", false);
        cfg.sync();
    }

    destUrl.setPath( destUrl.directory() );
    OrgKdeKDirNotifyInterface::emitFilesAdded( destUrl.url() );

    if (item)
        item->setOpen(true);
}
开发者ID:theunbelievablerepo,项目名称:dolphin2.1,代码行数:46,代码来源:konq_sidebartree.cpp

示例13: serviceForUrl

KService::Ptr serviceForUrl(const KUrl & url)
{
    QString runner = url.host();
    QString id = url.fragment();

    if (id.startsWith(QLatin1Char('/'))) {
        id = id.remove(0, 1);
    }

    if (runner != QLatin1String("services")) {
        return KService::Ptr(NULL);
    }

    // URL path example: services_kde4-kate.desktop
    // or: services_firefox.desktop
    id.remove("services_");

    return KService::serviceByStorageId(id);
}
开发者ID:aarontc,项目名称:kde-workspace,代码行数:19,代码来源:krunnermodel.cpp

示例14: setValues

void ChooseSocket::setValues(const QVariantHash &args)
{
    if (m_args == args) {
        return;
    }

    m_args = args;
    ui->addressLE->clear();
    ui->portISB->setValue(9100);
    QString deviceUri = args[KCUPS_DEVICE_URI].toString();
    KUrl url = deviceUri;
    if (url.scheme() == QLatin1String("socket")) {
        ui->addressLE->setText(url.host());
        ui->portISB->setValue(url.port(9100));
    }
    ui->addressLE->setFocus();

    m_isValid = true;
}
开发者ID:freexploit,项目名称:print-manager,代码行数:19,代码来源:ChooseSocket.cpp

示例15: generateKey

static QString generateKey(const KUrl& url)
{
  QString key;

  if (url.isValid()) {
    key = url.protocol();
    key += QLatin1Char(':');

    if (url.hasHost()) {
      key += url.host();
      key += QLatin1Char(':');
    }

    if (url.hasPath()) {
        key += url.path();
    }
  }

  return key;
}
开发者ID:theunbelievablerepo,项目名称:dolphin2.1,代码行数:20,代码来源:dirfilterplugin.cpp


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