Commit bfeac95d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Rename and install findbarwebview

parent 2aa046bc
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(MESSAGELIB_LIB_VERSION "5.1.50")
set(MESSAGELIB_LIB_VERSION "5.1.51")
set(KF5_VERSION "5.17.0")
set(KDEPIMLIBS_LIB_VERSION "5.1.42")
......
......@@ -138,7 +138,7 @@ set(libmessageviewer_scamdetection_SRCS
set(libmessageviewer_findbar_SRCS
findbar/findbarbase.cpp
findbar/findbarmailwebview.cpp
findbar/findbarwebview.cpp
findbar/findbarsourceview.cpp
)
......@@ -305,6 +305,16 @@ ecm_generate_headers(MessageViewer_Camelcaseutils_HEADERS
RELATIVE utils
)
ecm_generate_headers(MessageViewer_Camelfindbar_HEADERS
HEADER_NAMES
FindBarWebView
FindBarBase
REQUIRED_HEADERS MessageViewer_findbar_HEADERS
PREFIX MessageViewer
RELATIVE findbar
)
ecm_generate_headers(MessageViewer_Camelcaseantispam_HEADERS
HEADER_NAMES
SpamHeaderAnalyzer
......@@ -412,6 +422,7 @@ install(FILES
${MessageViewer_Camelcasemain_HEADERS}
${MessageViewer_Camelcaseviewerjob_HEADERS}
${MessageViewer_Camelcaseantispam_HEADERS}
${MessageViewer_Camelfindbar_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer
COMPONENT Devel
)
......@@ -430,6 +441,7 @@ install(FILES
${MessageViewer_widgets_HEADERS}
${MessageViewer_viewerjob_HEADERS}
${MessageViewer_antispam_HEADERS}
${MessageViewer_findbar_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/messageviewer_export.h
${CMAKE_CURRENT_BINARY_DIR}/globalsettings_messageviewer.h
${CMAKE_CURRENT_BINARY_DIR}/messageviewer_debug.h
......
......@@ -3,4 +3,4 @@ ecm_add_test(findbarbasetest.cpp ../findbarbase.cpp
NAME_PREFIX "messageviewer-findbar-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::Completion KF5::I18n KF5::ConfigWidgets KF5::PimCommon
)
set_property(TARGET findbarbasetest PROPERTY INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/messageviewer)
set_property(TARGET findbarbasetest PROPERTY INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/messageviewer ${CMAKE_BINARY_DIR}/messageviewer/src)
......@@ -21,7 +21,7 @@
#define FINDBARBASE_H
#include <QWidget>
#include "messageviewer_export.h"
class QAction;
class QPushButton;
class QMenu;
......@@ -32,7 +32,7 @@ class LineEditWithCompleter;
}
namespace MessageViewer
{
class FindBarBase : public QWidget
class MESSAGEVIEWER_EXPORT FindBarBase : public QWidget
{
Q_OBJECT
public:
......
......@@ -16,15 +16,15 @@
* Boston, MA 02110-1301, USA.
*/
#include "findbarmailwebview.h"
#include "findbarwebview.h"
#include "PimCommon/LineEditWithCompleter"
#include "viewer/mailwebview.h"
#include <QWebView>
#include <KLocalizedString>
#include <QMenu>
using namespace MessageViewer;
FindBarMailWebView::FindBarMailWebView(MailWebView *view, QWidget *parent)
FindBarWebView::FindBarWebView(QWebView *view, QWidget *parent)
: FindBarBase(parent), mView(view)
{
QMenu *options = optionsMenu();
......@@ -32,15 +32,15 @@ FindBarMailWebView::FindBarMailWebView(MailWebView *view, QWidget *parent)
mHighlightAll->setCheckable(true);
mFindInSelection = options->addAction(i18n("Find in selection first"));
mFindInSelection->setCheckable(true);
connect(mHighlightAll, &QAction::toggled, this, &FindBarMailWebView::slotHighlightAllChanged);
connect(mFindInSelection, &QAction::toggled, this, &FindBarMailWebView::slotFindSelectionFirstChanged);
connect(mHighlightAll, &QAction::toggled, this, &FindBarWebView::slotHighlightAllChanged);
connect(mFindInSelection, &QAction::toggled, this, &FindBarWebView::slotFindSelectionFirstChanged);
}
FindBarMailWebView::~FindBarMailWebView()
FindBarWebView::~FindBarWebView()
{
}
void FindBarMailWebView::searchText(bool backward, bool isAutoSearch)
void FindBarWebView::searchText(bool backward, bool isAutoSearch)
{
QWebPage::FindFlags searchOptions = QWebPage::FindWrapsAroundDocument;
......@@ -68,7 +68,7 @@ void FindBarMailWebView::searchText(bool backward, bool isAutoSearch)
setFoundMatch(found);
}
void FindBarMailWebView::updateHighLight(bool highLight)
void FindBarWebView::updateHighLight(bool highLight)
{
bool found = false;
if (highLight) {
......@@ -84,7 +84,7 @@ void FindBarMailWebView::updateHighLight(bool highLight)
setFoundMatch(found);
}
void FindBarMailWebView::updateSensitivity(bool sensitivity)
void FindBarWebView::updateSensitivity(bool sensitivity)
{
QWebPage::FindFlags searchOptions = QWebPage::FindWrapsAroundDocument;
if (sensitivity) {
......@@ -98,7 +98,7 @@ void FindBarMailWebView::updateSensitivity(bool sensitivity)
setFoundMatch(found);
}
void FindBarMailWebView::slotFindSelectionFirstChanged(bool findSectionFirst)
void FindBarWebView::slotFindSelectionFirstChanged(bool findSectionFirst)
{
QWebPage::FindFlags searchOptions = QWebPage::FindWrapsAroundDocument;
if (findSectionFirst) {
......@@ -112,9 +112,11 @@ void FindBarMailWebView::slotFindSelectionFirstChanged(bool findSectionFirst)
setFoundMatch(found);
}
void FindBarMailWebView::clearSelections()
void FindBarWebView::clearSelections()
{
mView->clearFindSelection();
//WEBKIT: TODO: Find a way to unselect last selection
// http://bugreports.qt.nokia.com/browse/QTWEBKIT-80
mView->findText(QString(), QWebPage::HighlightAllOccurrences);
mLastSearchStr.clear();
FindBarBase::clearSelections();
}
......
......@@ -20,24 +20,22 @@
#define MESSAGEVIEWER_FINDBAR_MAILWEBVIEW_H
#include "findbarbase.h"
#include "messageviewer_export.h"
namespace MessageViewer
{
class MailWebView;
}
class QWebView;
namespace MessageViewer
{
class FindBarMailWebView : public FindBarBase
class MESSAGEVIEWER_EXPORT FindBarWebView : public FindBarBase
{
Q_OBJECT
public:
explicit FindBarMailWebView(MailWebView *view, QWidget *parent = Q_NULLPTR);
~FindBarMailWebView();
explicit FindBarWebView(QWebView *view, QWidget *parent = Q_NULLPTR);
~FindBarWebView();
private:
explicit FindBarMailWebView(QWidget *parent)
explicit FindBarWebView(QWidget *parent)
{
Q_UNUSED(parent);
}
......@@ -49,7 +47,7 @@ private:
private Q_SLOTS:
void slotFindSelectionFirstChanged(bool findSectionFirst);
private:
MailWebView *mView;
QWebView *mView;
QAction *mHighlightAll;
QAction *mFindInSelection;
};
......
......@@ -299,14 +299,6 @@ void MailWebView::setElementByIdVisible(const QString &id, bool visible)
}
}
void MailWebView::clearFindSelection()
{
//WEBKIT: TODO: Find a way to unselect last selection
// http://bugreports.qt.nokia.com/browse/QTWEBKIT-80
KWebView::findText(QString(), QWebPage::HighlightAllOccurrences);
}
void MailWebView::keyReleaseEvent(QKeyEvent *e)
{
if (MessageViewer::MessageViewerSettings::self()->accessKeyEnabled()) {
......
......@@ -42,8 +42,6 @@ public:
explicit MailWebView(KActionCollection *actionCollection = Q_NULLPTR, QWidget *parent = Q_NULLPTR);
~MailWebView();
void clearFindSelection();
void scrollUp(int pixels);
void scrollDown(int pixels);
bool isScrolledToBottom() const;
......
......@@ -125,7 +125,7 @@
#include "messageviewer/messageviewerutil.h"
#include "widgets/vcardviewer.h"
#include "viewer/mailwebview.h"
#include "findbar/findbarmailwebview.h"
#include "findbar/findbarwebview.h"
#include "header/headerstylemenumanager.h"
#include "messageviewer/bodypart.h"
......@@ -1482,7 +1482,7 @@ void ViewerPrivate::createWidgets()
mSliderContainer = new KPIMTextEdit::SlideContainer(readerBox);
mSliderContainer->setObjectName(QStringLiteral("slidercontainer"));
readerBoxVBoxLayout->addWidget(mSliderContainer);
mFindBar = new FindBarMailWebView(mViewer, q);
mFindBar = new FindBarWebView(mViewer, q);
connect(mFindBar, &FindBarBase::hideFindBar, mSliderContainer, &KPIMTextEdit::SlideContainer::slideOut);
mSliderContainer->setContent(mFindBar);
......
......@@ -71,7 +71,7 @@ class HtmlWriter;
class CSSHelper;
class AttachmentStrategy;
class ObjectTreeParser;
class FindBarMailWebView;
class FindBarWebView;
class WebKitPartHtmlWriter;
class HtmlStatusBar;
class MailWebView;
......@@ -601,7 +601,7 @@ public:
MimePartTreeView *mMimePartTree;
#endif
MailWebView *mViewer;
FindBarMailWebView *mFindBar;
FindBarWebView *mFindBar;
const AttachmentStrategy *mAttachmentStrategy;
QTimer mUpdateReaderWinTimer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment