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


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

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


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

示例1: info

ViewProperties::ViewProperties(const KUrl& url) :
    m_changedProps(false),
    m_autoSave(true),
    m_node(0)
{
    GeneralSettings* settings = DolphinSettings::instance().generalSettings();
    const bool useGlobalViewProps = settings->globalViewProps();
    bool useDetailsViewWithPath = false;

    // We try and save it to the file .directory in the directory being viewed.
    // If the directory is not writable by the user or the directory is not local,
    // we store the properties information in a local file.
    if (useGlobalViewProps) {
        m_filePath = destinationDir("global");
    } else if (url.protocol().contains("search")) {
        m_filePath = destinationDir("search");
        useDetailsViewWithPath = true;
    } else if (url.protocol() == QLatin1String("trash")) {
        m_filePath = destinationDir("trash");
        useDetailsViewWithPath = true;
    } else if (url.isLocalFile()) {
        m_filePath = url.toLocalFile();
        const QFileInfo info(m_filePath);
        if (!info.isWritable() || !isPartOfHome(m_filePath)) {
            m_filePath = destinationDir("local") + m_filePath;
        }
    } else {
        m_filePath = destinationDir("remote") + m_filePath;
    }

    const QString file = m_filePath + QDir::separator() + QLatin1String(".directory");
    m_node = new ViewPropertySettings(KSharedConfig::openConfig(file));

    // If the .directory file does not exist or the timestamp is too old,
    // use default values instead.
    const bool useDefaultProps = (!useGlobalViewProps || useDetailsViewWithPath) &&
                                 (!QFileInfo(file).exists() ||
                                  (m_node->timestamp() < settings->viewPropsTimestamp()));
    if (useDefaultProps) {
        if (useDetailsViewWithPath) {
            setViewMode(DolphinView::DetailsView);
            setAdditionalInfo(KFileItemDelegate::InformationList() << KFileItemDelegate::LocalPathOrUrl);
        } else {
            // The global view-properties act as default for directories without
            // any view-property configuration
            settings->setGlobalViewProps(true);

            ViewProperties defaultProps(url);
            setDirProperties(defaultProps);

            settings->setGlobalViewProps(false);
            m_changedProps = false;
        }
    }
}
开发者ID:vishesh,项目名称:kde-baseapps,代码行数:55,代码来源:viewproperties.cpp

示例2: copy

void TrashProtocol::copy( const KUrl &src, const KUrl &dest, int /*permissions*/, KIO::JobFlags flags )
{
    INIT_IMPL;

    kDebug()<<"TrashProtocol::copy(): " << src << " " << dest;

    if (src.protocol() == QLatin1String("trash") && dest.protocol() == QLatin1String("trash")) {
        error( KIO::ERR_UNSUPPORTED_ACTION, i18n( "This file is already in the trash bin." ) );
        return;
    }

    copyOrMove( src, dest, (flags & KIO::Overwrite), Copy );
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:13,代码来源:kio_trash.cpp

示例3: rename

void TrashProtocol::rename( const KUrl &oldURL, const KUrl &newURL, KIO::JobFlags flags )
{
    INIT_IMPL;

    kDebug()<<"TrashProtocol::rename(): old="<<oldURL<<" new="<<newURL<<" overwrite=" << (flags & KIO::Overwrite);

    if (oldURL.protocol() == QLatin1String("trash") && newURL.protocol() == QLatin1String("trash")) {
        error( KIO::ERR_CANNOT_RENAME, oldURL.prettyUrl() );
        return;
    }

    copyOrMove( oldURL, newURL, (flags & KIO::Overwrite), Move );
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:13,代码来源:kio_trash.cpp

示例4: slotOpenURLRequest

// We only generate pages when the user clicks on a link
void StatisticsDialog::slotOpenURLRequest ( const KUrl& url, const KParts::OpenUrlArguments &, const KParts::BrowserArguments & )
{
	if ( url.protocol() == "main" )
	{
		generatePageGeneral();
	}
	else if ( url.protocol() == "dayofweek" )
	{
		generatePageForDay ( url.path().toInt() );
	}
	else if ( url.protocol() == "monthofyear" )
	{
		generatePageForMonth ( url.path().toInt() );
	}
}
开发者ID:Jtalk,项目名称:kopete-fork-xep0136,代码行数:16,代码来源:statisticsdialog.cpp

示例5: parser

bool KMail::Util::handleClickedURL( const KUrl &url, const QSharedPointer<MailCommon::FolderCollection> &folder )
{
  if ( url.protocol() == QLatin1String( "mailto" ) )
  {
    KMime::Message::Ptr msg ( new KMime::Message );
    uint identity = folder->identity();
    MessageHelper::initHeader( msg, KMKernel::self()->identityManager(), identity );
    msg->contentType()->setCharset("utf-8");

    QMap<QString, QString> fields =  MessageCore::StringUtil::parseMailtoUrl( url );

    msg->to()->fromUnicodeString( fields.value( "to" ),"utf-8" );
    if ( !fields.value( "subject" ).isEmpty() )
      msg->subject()->fromUnicodeString( fields.value( "subject" ),"utf-8" );
    if ( !fields.value( "body" ).isEmpty() )
      msg->setBody( fields.value( "body" ).toUtf8() );
    if ( !fields.value( "cc" ).isEmpty() )
      msg->cc()->fromUnicodeString( fields.value( "cc" ),"utf-8" );

    TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::NewMessage );
    parser.setIdentityManager( KMKernel::self()->identityManager() );
    parser.process( msg, folder->collection() );

    KMail::Composer * win = KMail::makeComposer( msg, false, false, KMail::Composer::New, identity );
    win->setFocusToSubject();
    win->setCollectionForNewMessage( folder->collection() );
    win->show();
    return true;
  } else {
    kWarning() << "Can't handle URL:" << url;
    return false;
  }
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:33,代码来源:util.cpp

示例6: msg

bool KMail::Util::handleClickedURL( const KUrl &url )
{
  if ( url.protocol() == QLatin1String( "mailto" ) )
  {
    KMime::Message::Ptr msg ( new KMime::Message );
    MessageHelper::initHeader( msg, KMKernel::self()->identityManager(), 0 );
    msg->contentType()->setCharset("utf-8");

    QMap<QString, QString> fields =  MessageCore::StringUtil::parseMailtoUrl( url );

    msg->to()->fromUnicodeString( fields.value( "to" ),"utf-8" );
    if ( !fields.value( "subject" ).isEmpty() )
      msg->subject()->fromUnicodeString( fields.value( "subject" ),"utf-8" );
    if ( !fields.value( "body" ).isEmpty() )
      msg->setBody( fields.value( "body" ).toUtf8() );
    if ( !fields.value( "cc" ).isEmpty() )
      msg->cc()->fromUnicodeString( fields.value( "cc" ),"utf-8" );

    KMail::Composer * win = KMail::makeComposer( msg, false, false,KMail::Composer::New, 0 );
    win->setFocusToSubject();
    win->show();
    return true;
  } else {
    kWarning() << "Can't handle URL:" << url;
    return false;
  }
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:27,代码来源:util.cpp

示例7: slotItemSelected

void Navigator::slotItemSelected( QTreeWidgetItem *currentItem )
{
  if ( !currentItem ) return;

  mSelected = true;

  NavigatorItem *item = static_cast<NavigatorItem *>( currentItem );

  kDebug(1400) << item->entry()->name() << endl;

  item->setExpanded( !item->isExpanded() );

  KUrl url ( item->entry()->url() );

  
  
  if ( url.protocol() == "khelpcenter" ) {
      mView->closeUrl();
      History::self().updateCurrentEntry( mView );
      History::self().createEntry();
      showOverview( item, url );
  } else {
   
    emit itemSelected( url.url() );
  }

  mLastUrl = url;
}
开发者ID:KDE,项目名称:kde-runtime,代码行数:28,代码来源:navigator.cpp

示例8: 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

示例9: init

void KexiStartupFileHandler::init(const KUrl &startDirOrVariable, Mode mode)
{
/*    if (d->requester || d->dialog) {
        QWidget *w = d->requester ? static_cast<QWidget*>(d->requester) : 
            static_cast<QWidget*>(d->dialog);
        connect(w, SIGNAL(destroyed()), this, SLOT(saveRecentDir()));
    }*/
    connect(d->dialog, SIGNAL(accepted()), this, SLOT(slotAccepted()));
    //d->dialog->setStartDir(startDirOrVariable);
    KUrl url;
    if (startDirOrVariable.protocol() == "kfiledialog") {
        url = KFileDialog::getStartUrl(startDirOrVariable, d->recentDirClass);
    }
    else {
        url = startDirOrVariable;
    }
    if (d->requester)
        d->requester->setUrl(url);
    else
        d->dialog->setUrl(url);
    //setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    setMode(mode);
    QAction *previewAction = d->dialog->actionCollection()->action("preview");
    if (previewAction)
        previewAction->setChecked(false);

    // setFocusProxy(locationEdit());

//    connect(dialog, SIGNAL(fileHighlighted(QString)),
//            this, SLOT(slotExistingFileHighlighted(QString)));
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:31,代码来源:KexiStartupFileHandler.cpp

示例10: if

BreadcrumbSiblingList
FileBrowser::Private::siblingsForDir( const KUrl &path )
{
    BreadcrumbSiblingList siblings;
    if( path.protocol() == "places" )
    {
        for( int i = 0; i < placesModel->rowCount(); i++ )
        {
            QModelIndex idx = placesModel->index( i, 0 );

            QString name = idx.data( Qt::DisplayRole ).toString();
            QString url = idx.data( KFilePlacesModel::UrlRole ).toString();
            if( url.isEmpty() )
                // the place perhaps needs mounting, use places url instead
                url = placesString + name;
            siblings << BreadcrumbSibling( idx.data( Qt::DecorationRole ).value<QIcon>(),
                                           name, url );
        }
    }
    else if( path.isLocalFile() )
    {
        QDir dir( path.toLocalFile() );
        dir.cdUp();
        foreach( const QString &item, dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
        {
            siblings << BreadcrumbSibling( KIcon( "folder-amarok" ), item,
                                           dir.absoluteFilePath( item ) );
        }
    }
开发者ID:netrunner-debian-kde-extras,项目名称:amarok,代码行数:29,代码来源:FileBrowser.cpp

示例11: checkIfFolder

void AsyncFileTester::checkIfFolder(const QModelIndex &index, QObject *object, const char *method)
{
    if (!index.isValid()) {
        callResultMethod(object, method, index, false);
        return;
    }

    KFileItem item = static_cast<const ProxyModel*>(index.model())->itemForIndex(index);
    KUrl url = item.targetUrl();
    
    if (item.isDir()) {
        callResultMethod(object, method, index, true);
        return;
    }
    
    if (item.isDesktopFile()) {
        // Check if the desktop file is a link to a local folder
        KDesktopFile file(url.path());
        if (file.readType() == "Link") {
            url = file.readUrl();
            if (url.isLocalFile()) {
                KFileItem destItem(KFileItem::Unknown, KFileItem::Unknown, url);
                callResultMethod(object, method, index, destItem.isDir());
                return;
            }
            
            if (KProtocolInfo::protocolClass(url.protocol()) == QString(":local")) {
                AsyncFileTester *tester = new AsyncFileTester(index, object, method);
                tester->delayedFolderCheck(url);
                return;
            }
        }
    }
    callResultMethod(object, method, index, false);
}
开发者ID:blue-shell,项目名称:folderview,代码行数:35,代码来源:asyncfiletester.cpp

示例12: loadSilently

    void Core::loadSilently(const KUrl& url, const QString& group)
    {
        if (url.protocol() == "magnet")
        {
            MagnetLinkLoadOptions options;
            options.silently = true;
            options.group = group;
            load(bt::MagnetLink(url.prettyUrl()), options);
        }
        else if (url.isLocalFile())
        {
            QString path = url.toLocalFile();
            QString dir = locationHint(group);

            if (dir != QString::null)
                loadFromFile(path, dir, group, true);
        }
        else
        {
            // download to a random file in tmp
            KIO::Job* j = KIO::storedGet(url);
            connect(j, SIGNAL(result(KJob*)), this, SLOT(downloadFinishedSilently(KJob*)));
            if (!group.isNull())
                add_to_groups.insert(url, group);
        }
    }
开发者ID:zidel,项目名称:ktorrent,代码行数:26,代码来源:core.cpp

示例13:

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

示例14: setCurrentUrl

void KDirSelectDialog::setCurrentUrl( const KUrl& url )
{
    if ( !url.isValid() )
        return;

    if (url.protocol() != d->m_rootUrl.protocol()) {
        KUrl u( url );
        u.cd("/");//NOTE portability?
        d->m_treeView->setRootUrl( u );
        d->m_rootUrl = u;
    }

    //Check if url represents a hidden folder and enable showing them
    QString fileName = url.fileName();
    //TODO a better hidden file check?
    bool isHidden = fileName.length() > 1 && fileName[0] == '.' &&
                                                (fileName.length() > 2 ? fileName[1] != '.' : true);
    bool showHiddenFiles = isHidden && !d->m_treeView->showHiddenFiles();
    if (showHiddenFiles) {
        d->showHiddenFoldersAction->setChecked(true);
        d->m_treeView->setShowHiddenFiles(true);
    }

    d->m_treeView->setCurrentUrl( url );
}
开发者ID:fluxer,项目名称:kdelibs,代码行数:25,代码来源:kdirselectdialog.cpp

示例15: 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


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