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


C++ Document::url方法代码示例

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


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

示例1: activeView

KTextEditor::View *KateViewManager::openUrlWithView (const KUrl &url, const QString& encoding)
{
  KTextEditor::Document *doc = KateDocManager::self()->openUrl (url, encoding);

  if (!doc)
    return 0;

  if (!doc->url().isEmpty())
    m_mainWindow->fileOpenRecent->addUrl( doc->url() );

  activateView( doc );

  return activeView ();
}
开发者ID:rtaycher,项目名称:kate,代码行数:14,代码来源:kateviewmanager.cpp

示例2: slotCopyFilename

void KateFileTree::slotCopyFilename()
{
  KTextEditor::Document *doc = model()->data(m_indexContextMenu, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
  if (doc) {
    QApplication::clipboard()->setText(doc->url().url());
  }
}
开发者ID:azat-archive,项目名称:kate,代码行数:7,代码来源:katefiletree.cpp

示例3: slotOpenWithMenuAction

void KateFileTree::slotOpenWithMenuAction(QAction* a)
{
  KUrl::List list;
  
  KTextEditor::Document *doc = model()->data(m_indexContextMenu, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
  if (!doc) return;

  
  list.append( doc->url() );

  const QString openWith = a->data().toString();
  if (openWith.isEmpty())
  {
    // display "open with" dialog
    KOpenWithDialog dlg(list);
    if (dlg.exec())
      KRun::run(*dlg.service(), list, this);
    return;
  }

  KService::Ptr app = KService::serviceByDesktopPath(openWith);
  if (app)
  {
    KRun::run(*app, list, this);
  }
  else
  {
    KMessageBox::error(this, i18n("Application '%1' not found.", openWith), i18n("Application not found"));
  }
}
开发者ID:azat-archive,项目名称:kate,代码行数:30,代码来源:katefiletree.cpp

示例4: activateView

KTextEditor::Document *KateViewManager::openUrl (const KUrl &url,
                                                 const QString& encoding,
                                                 bool activate,
                                                 bool isTempFile,
                                                 const KateDocumentInfo& docInfo)
{
  KTextEditor::Document *doc = KateDocManager::self()->openUrl (url, encoding, isTempFile, docInfo);

  if (!doc->url().isEmpty())
    m_mainWindow->fileOpenRecent->addUrl( doc->url() );

  if (activate)
    activateView( doc );

  return doc;
}
开发者ID:rtaycher,项目名称:kate,代码行数:16,代码来源:kateviewmanager.cpp

示例5: run

void View::run()
{
  KTextEditor::View *view = mw->activeView();

  if (!view) {
    return;
  }
  if (m_global.saveBeforeRun) {
    view->document()->save();
  }

  KTextEditor::Document *doc = view->document();
  QString filename = doc->url().path();
  QString directory = doc->url().directory();

  kDebug() << filename << "-" << directory;
  QString cmd = txtCommand->text();
  cmd = cmd.replace("%filename", filename).replace("%directory", directory);
  execute(cmd);
}
开发者ID:hgrecco,项目名称:KateCodeinfo,代码行数:20,代码来源:kciview.cpp

示例6: allMatches

// Scan throughout the entire document for possible completions,
// ignoring any dublets
const QStringList KateWordCompletionModel::allMatches( KTextEditor::View *view, const KTextEditor::Range &range ) const
{
  KTextEditor::Document *doc = view->document();
  QString match_str = doc->text(range);
  QString s, m;
  QSet<QString> seen;
  QStringList l;

  int i( 0 );
  int pos( 0 );

  QRegExp re( "\\b(" + match_str + "\\w{1,})" );

  while( i < doc->lines() )
  {
      s = doc->line( i );
      pos = 0;
      while ( pos >= 0 )
      {
        pos = re.indexIn( s, pos );
        if ( pos >= 0 )
        {
          // typing in the middle of a word
          if ( ! ( i == range.start().line() && pos == range.start().column() ) )
          {
            m = re.cap( 1 );
            if ( ! seen.contains( m ) ) {
              seen.insert( m );
              l << m;
            }
          }
          pos += re.matchedLength();
        }
      }
    i++;
  }

  // Global completion
  // int db_area = KDebug::registerArea("ktuan-debug");
  QMap<QString, QStringList>::const_iterator ci = doc_word_list.constBegin();
  while (ci != doc_word_list.constEnd()) {
  if (ci.key() != doc->url().prettyUrl()) {
    QStringList list = ci.value();
    foreach (QString word, list) {
      // kDebug(db_area) << "complete word " << word;
      if (word.startsWith(match_str) && !seen.contains(word)) {
        // kDebug(db_area) << "Global completion";
        seen.insert(word);
        l << word;
      }
    }
  }
  ++ci;
  }
开发者ID:ktuan89,项目名称:kate-4.8.0,代码行数:56,代码来源:katewordcompletion.cpp

示例7: contents

	virtual QString contents( const QString& fileName )
	{
		QString contents = QString::null;
		
		if ( !m_readFromDisk )
		{
			m_deadlock.unlock();
			// GET LOCK
			kapp->lock ();
			
			//kdDebug(9007) << "-------> kapp locked" << endl;
			
			QPtrList<KParts::Part> parts( *m_cppSupport->partController() ->parts() );
			QPtrListIterator<KParts::Part> it( parts );
			while ( it.current() )
			{
				KTextEditor::Document * doc = dynamic_cast<KTextEditor::Document*>( it.current() );
				++it;
				
				KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>( doc );
				if ( !doc || !editIface || doc->url().path() != fileName )
					continue;
				
				contents = QString( editIface->text().ascii() ); // deep copy
				
				//kdDebug(9007) << "-------> kapp unlocked" << endl;
				
				break;
			}

			// RELEASE LOCK
			kapp->unlock();
			m_deadlock.lock();
			//kdDebug(9007) << "-------> kapp unlocked" << endl;
		}
		
		if( m_readFromDisk || contents == QString::null )
		{
			QFile f( fileName );
			if ( f.open( IO_ReadOnly ) )
			{
				QTextStream stream( &f );
				contents = stream.read();
				f.close();
			}
		}
		
		return contents;
	}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:49,代码来源:backgroundparser.cpp

示例8: readFromEditor

QStringList PHPFile::readFromEditor()
{
   QStringList contents;

   kapp->lock();
   QPtrList<KParts::Part> parts( *m_part->partController()->parts() );
   QPtrListIterator<KParts::Part> it( parts );
   while( it.current() ){
      KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( it.current() );
      ++it;

      KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>( doc );
      if ( !doc || !editIface || doc->url().path() != fileName() )
         continue;

      contents = QStringList::split("\n", editIface->text().ascii(), true);
      break;
   }
   kapp->unlock();

   return contents;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:22,代码来源:phpfile.cpp

示例9: slotDiff

// ### the code below is slightly modified from kdelibs/kate/part/katedialogs,
// class KateModOnHdPrompt.
void KateMwModOnHdDialog::slotDiff()
{
  if ( !btnDiff->isEnabled()) // diff button already pressed, proc not finished yet
    return;

  if ( ! twDocuments->currentItem() )
    return;

  KTextEditor::Document *doc = ((KateDocItem*)twDocuments->currentItem())->document;

  // don't try to diff a deleted file
  if ( KateDocManager::self()->documentInfo( doc )->modifiedOnDiscReason == KTextEditor::ModificationInterface::OnDiskDeleted )
    return;

  if (m_diffFile)
    return;

  m_diffFile = new KTemporaryFile();
  m_diffFile->open();

  // Start a KProcess that creates a diff
  m_proc = new KProcess( this );
  m_proc->setOutputChannelMode( KProcess::MergedChannels );
  *m_proc << "diff" << "-ub" << "-" << doc->url().toLocalFile();
  connect( m_proc, SIGNAL(readyRead()), this, SLOT(slotDataAvailable()) );
  connect( m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotPDone()) );

  setCursor( Qt::WaitCursor );
  btnDiff->setEnabled(false);

  m_proc->start();

  QTextStream ts(m_proc);
  int lastln = doc->lines();
  for ( int l = 0; l < lastln; ++l )
    ts << doc->line( l ) << '\n';
  ts.flush();
  m_proc->closeWriteChannel();
}
开发者ID:UIKit0,项目名称:kate,代码行数:41,代码来源:katemwmodonhddialog.cpp


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