File indexing completed on 2024-12-08 04:33:11

0001 /*
0002     SPDX-FileCopyrightText: 2002 Dave Corrie <kde@davecorrie.com>
0003     SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 #include "libruqola_private_export.h"
0010 #include <QString>
0011 
0012 class LIBRUQOLACORE_TESTS_EXPORT KTextToHTMLHelper
0013 {
0014 public:
0015     KTextToHTMLHelper(const QString &plainText, int pos = 0, int maxUrlLen = 4096, int maxAddressLen = 255);
0016 
0017     [[nodiscard]] QString getEmailAddress();
0018     [[nodiscard]] QString getPhoneNumber();
0019     [[nodiscard]] bool atUrl() const;
0020     [[nodiscard]] bool isEmptyUrl(const QString &url) const;
0021     [[nodiscard]] QString getUrl(bool *badurl = nullptr);
0022     [[nodiscard]] QString highlightedText();
0023 
0024     QString mText;
0025     int mMaxUrlLen;
0026     int mMaxAddressLen;
0027     int mPos;
0028 };