30 #include <QApplication>
32 #include <QtCore/QString>
34 #include <QtCore/QSharedData>
42 QMutableListIterator<Filter*> iter(*
this);
44 while ( iter.hasNext() )
62 return contains(filter);
66 QListIterator<Filter*> iter(*
this);
67 while (iter.hasNext())
72 QListIterator<Filter*> iter(*
this);
73 while (iter.hasNext())
74 iter.next()->setBuffer(buffer,linePositions);
78 QListIterator<Filter*> iter(*
this);
79 while (iter.hasNext())
80 iter.next()->process();
88 QListIterator<Filter*> iter(*
this);
89 while (iter.hasNext())
105 QListIterator<Filter*> iter(*
this);
106 while (iter.hasNext())
142 QString* newBuffer =
new QString();
144 setBuffer( newBuffer , newLinePositions );
153 QTextStream lineStream(
_buffer);
154 decoder.
begin(&lineStream);
156 for (
int i=0 ; i < lines ; i++)
172 lineStream << QChar(
'\n');
187 while (iter.hasNext())
217 nextLine =
_buffer->length() + 1;
227 if (
_linePositions->value(i) <= position && position < nextLine )
254 for (
int line = spot->startLine() ;
line <= spot->endLine() ;
line++)
270 QListIterator<HotSpot*> spotIter(
_hotspots.values(line));
272 while (spotIter.hasNext())
274 HotSpot* spot = spotIter.next();
288 : _startLine(startLine)
289 , _startColumn(startColumn)
291 , _endColumn(endColumn)
292 , _type(NotSpecified)
344 _capturedTexts = texts;
348 return _capturedTexts;
372 static const QString emptyString(
"");
399 spot->setCapturedTexts(
_searchText.capturedTexts());
411 int endLine,
int endColumn)
430 QString url = capturedTexts().first();
432 const UrlType kind = urlType();
434 if ( kind == StandardUrl )
436 else if ( kind == Email )
443 QString url = capturedTexts().first();
455 QString url = capturedTexts().first();
457 const UrlType kind = urlType();
459 const QString& actionName =
object ?
object->objectName() : QString();
461 if ( actionName ==
"copy-action" )
465 QApplication::clipboard()->setText(url);
469 if ( !
object || actionName ==
"open-action" )
471 if ( kind == StandardUrl )
475 if (!url.contains(
"://"))
477 url.prepend(
"http://");
480 else if ( kind == Email )
482 url.prepend(
"mailto:");
516 _filter->activate(sender());
522 const UrlType kind = urlType();
524 QAction* openAction =
new QAction(_urlObject);
525 QAction* copyAction =
new QAction(_urlObject);;
527 Q_ASSERT( kind == StandardUrl || kind == Email );
529 if ( kind == StandardUrl )
531 openAction->setText((
"Open Link"));
532 copyAction->setText((
"Copy Link Address"));
534 else if ( kind == Email )
536 openAction->setText((
"Send Email To..."));
537 copyAction->setText((
"Copy Email Address"));
543 openAction->setObjectName(
"open-action");
544 copyAction->setObjectName(
"copy-action");
546 QObject::connect( openAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) );
547 QObject::connect( copyAction , SIGNAL(triggered()) , _urlObject , SLOT(activated()) );