avoid using QString*, just use QString

svn path=/branches/work/kde4/playground/graphics/okular/; revision=544974
remotes/origin/old/work/newpageview
Pino Toscano 20 years ago
parent cc33f5c01b
commit 59b267386c
  1. 4
      core/page.cpp
  2. 2
      core/page.h
  3. 12
      core/textpage.cpp
  4. 2
      core/textpage.h
  5. 11
      ui/pageview.cpp

@ -131,9 +131,9 @@ RegularAreaRect * KPDFPage::findText( const QString & text, SearchDir dir, const
*/
}
QString * KPDFPage::getText( const RegularAreaRect * area ) const
QString KPDFPage::getText( const RegularAreaRect * area ) const
{
QString *ret= 0;
QString ret;
if ( !m_text )
return ret;

@ -70,7 +70,7 @@ class OKULAR_EXPORT KPDFPage
bool hasTransition() const;
RegularAreaRect * findText( const QString & text, SearchDir dir, bool strictCase, const RegularAreaRect * lastRect=0) const;
QString * getText( const RegularAreaRect * rect ) const;
QString getText( const RegularAreaRect * rect ) const;
RegularAreaRect * getTextArea ( TextSelection * ) const;
// const ObjectRect * getObjectRect( double x, double y ) const;
const ObjectRect * getObjectRect( ObjectRect::ObjectType type, double x, double y ) const;

@ -297,13 +297,13 @@ RegularAreaRect* KPDFTextPage::findTextInternal(const QString &query, bool forwa
return 0;
}
QString * KPDFTextPage::getText(const RegularAreaRect *area)
QString KPDFTextPage::getText(const RegularAreaRect *area) const
{
if (area->isNull())
return 0;
if (!area || area->isNull())
return QString();
QString* ret = new QString;
QList<KPDFTextEntity*>::Iterator it,end = m_words.end();
QString ret = "";
QList<KPDFTextEntity*>::ConstIterator it,end = m_words.end();
KPDFTextEntity * last=0;
for( it=m_words.begin() ; it != end; ++it )
{
@ -311,7 +311,7 @@ QString * KPDFTextPage::getText(const RegularAreaRect *area)
if (area->intersects((*it)->area))
{
// kDebug()<< "[" << (*it)->area->left << "," << (*it)->area->top << "]x["<< (*it)->area->right << "," << (*it)->area->bottom << "]\n";
*ret += ((*it)->txt);
ret += (*it)->txt;
last=*it;
}
}

@ -62,7 +62,7 @@ class KPDFTextPage {
public:
RegularAreaRect* findText(const QString &query, SearchDir & direct,
const bool &strictCase, const RegularAreaRect *area);
QString * getText(const RegularAreaRect *rect);
QString getText(const RegularAreaRect *rect) const;
RegularAreaRect * getTextArea ( TextSelection* ) const;
KPDFTextPage(QList<KPDFTextEntity*> words) : m_words(words) {};
KPDFTextPage() : m_words() {};

@ -1304,7 +1304,7 @@ if (d->document->handleEvent( e ) )
}
// if we support text generation
QString* selectedText=0;
QString selectedText;
if (d->document->supportsSearching())
{
// grab text in selection by extracting it from all intersected pages
@ -1334,9 +1334,9 @@ if (d->document->handleEvent( e ) )
// popup that ask to copy:text and copy/save:image
KMenu menu( this );
QAction *textToClipboard = 0, *speakText = 0, *imageToClipboard = 0, *imageToFile = 0;
if ( d->document->supportsSearching() && !selectedText->isEmpty() )
if ( d->document->supportsSearching() && !selectedText.isEmpty() )
{
menu.addTitle( i18np( "Text (1 character)", "Text (%n characters)", selectedText->length() ) );
menu.addTitle( i18np( "Text (1 character)", "Text (%n characters)", selectedText.length() ) );
textToClipboard = menu.addAction( SmallIconSet("editcopy"), i18n( "Copy to Clipboard" ) );
if ( !d->document->isAllowed( KPDFDocument::AllowCopy ) )
{
@ -1394,9 +1394,9 @@ if (d->document->handleEvent( e ) )
{
// [1] copy text to clipboard
QClipboard *cb = QApplication::clipboard();
cb->setText( *selectedText, QClipboard::Clipboard );
cb->setText( selectedText, QClipboard::Clipboard );
if ( cb->supportsSelection() )
cb->setText( *selectedText, QClipboard::Selection );
cb->setText( selectedText, QClipboard::Selection );
}
else if ( choice == speakText )
{
@ -1439,7 +1439,6 @@ if (d->document->handleEvent( e ) )
}
}
}
delete selectedText;
// clear widget selection and invalidate rect
selectionClear();

Loading…
Cancel
Save