D18144: Implemented find function from console

Albert Astals Cid noreply at phabricator.kde.org
Tue Jan 15 23:06:36 GMT 2019


aacid added a comment.


  Please make sure you configure your text editor to not change whitespaces, there's lots of unneeded whitespace changes that we don't want.

INLINE COMMENTS

> part.cpp:1602
> +        // Tries to find the text passed from terminal after the file is open
> +        findTextOnStartUp();
>      }

just move the code of the function here, it's three lines and makes it clearer it's something we only do here.

> part.cpp:3631
> +    delete m_textToFindOnOpen;
> +
> +}

This won't matter since i asked you to move m_textToFindOnOpen to be just a QString, but ehre you had a bug, you needed to reset m_textToFindOnOpen to nullptr after delete;

> part.h:413
> +        // String to search in document startup
> +        QString *m_textToFindOnOpen = nullptr;
> +

This should just be a QString, not a QString *, set to it QString() when clearing it for "already searched"

> shellutils.cpp:81
>  {
> -    return QStringLiteral("%1:%2:%3:%4:%5:%6").arg(startInPresentation).arg(showPrintDialog).arg(showPrintDialogAndExit).arg(unique).arg(noRaise).arg(page);
> +    return QStringLiteral("%1:%2:%3:%4:%5:%6:%7").arg(startInPresentation).arg(showPrintDialog).arg(showPrintDialogAndExit).arg(unique).arg(noRaise).arg(page).arg(find);
>  }

There is a problem here when find contains a :

that is, if you do

okular https://bugs.freedesktop.org/attachment.cgi?id=140739 -find "ate: "
 it will fail because when it goes to deserialize it it has "too many" :

So you need to encode it here and deserialize it properly on unserializeOptions

> findbar.cpp:200
>  
> +void FindBar::findTextOnStartUp(const QString & findText)
> +{

This doesn't really have much to do with findTextOnStartup, other than "it's the only place it's used for now"

But the function should be something more like "startSearch"

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D18144

To: joaonetto, #okular
Cc: ngraham, aacid, yurchor, okular-devel, tfella, darcyshen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190115/02112d3d/attachment-0001.html>


More information about the Okular-devel mailing list