Commit 63900d6a authored by Nicolás Alvarez's avatar Nicolás Alvarez

Initial import from the monolithic kdepim.

This is the beginning of revision history for this module. If you
want to look at revision history older than this, please refer to the
techbase wiki for how to use Git history grafting. At the time of
writing, this wiki is located here:

http://community.kde.org/Frameworks/GitOldHistory

If you have already performed the grafting and you don't see any
history beyond this commit, try running "git log" with the "--follow"
argument.

Branched from the monolithic repo, kdepim master branch, at commit
d0009536f24e8c7f4cc32a70936f5c25194e9a6f
parents
project(kdepim-apps-lib)
cmake_minimum_required(VERSION 2.8.12)
if(${CMAKE_SOURCE_DIR} STREQUAL ${kdepim-apps-lib_SOURCE_DIR})
# ECM setup
find_package(ECM 5.16.0 CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(LIBRARY_NAMELINK)
include(GenerateExportHeader)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(KF5_VERSION "5.16.0")
set(KDEPIMLIBS_LIB_VERSION "5.1.42")
set(KDEPIM_LIB_VERSION "5.1.42")
set(QT_REQUIRED_VERSION "5.4.0")
set(KMIME_LIB_VERSION "4.87.0")
set(KPIMTEXTEDIT_LIB_VERSION "5.1.42")
set(KCONTACTS_LIB_VERSION "4.92.0")
find_package(KF5Akonadi ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test UiTools WebKitWidgets DBus Gui)
find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5IconThemes ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Service ${KF5_VERSION} CONFIG REQUIRED)
find_package(Grantlee5 "5.0" CONFIG REQUIRED)
find_package(KF5Libkleo ${KDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5GrantleeTheme ${KDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiContact ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Sonnet ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiMime ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5WebKit ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimCommon ${KDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5CoreAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5DBusAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_VERSION} CONFIG REQUIRED)
endif()
add_subdirectory(composereditor-ng)
add_subdirectory(libfollowupreminder)
add_subdirectory(libkdepimdbusinterfaces)
add_subdirectory(libsendlater)
add_subdirectory(kaddressbookgrantlee)
if(${CMAKE_SOURCE_DIR} STREQUAL ${kdepim-apps-lib_SOURCE_DIR})
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
endif()
install( FILES kdepim-apps-lib.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
cmake_minimum_required(VERSION 2.8.12)
project(composereditorng)
if(${CMAKE_SOURCE_DIR} STREQUAL ${kdepim-apps-lib_SOURCE_DIR})
ecm_setup_version(${KDEPIM_LIB_VERSION} VARIABLE_PREFIX COMPOSEREDITORNG
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/composereditorng_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ComposerEditorNGConfigVersion.cmake"
SOVERSION 5
)
########### Targets ###########
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5ComposerEditorNG")
ecm_configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5ComposerEditorNGConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5ComposerEditorNGConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5ComposerEditorNGConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5ComposerEditorNGConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KF5ComposerEditorNGTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ComposerEditorNGTargets.cmake NAMESPACE KF5::)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/composereditorng_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)
else()
ecm_setup_version(${KDEPIM_LIB_VERSION} VARIABLE_PREFIX COMPOSEREDITORNG
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/composereditorng_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ComposerEditorNGConfigVersion.cmake"
SOVERSION 5
)
endif()
# Laurent install it if you want to debug it
#add_subdirectory(tests)
add_subdirectory(src)
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/KF5ComposerEditorNGTargets.cmake")
- Add default html actions (in progress)
- Add spell checking (in progress)
- Add background spell checking (qt-webkit-2.3) (In progress)
- Add hightlighting (4.12)
- Add support for signature (4.12)
- Add support for images (DONE)
- Add support for table (in progress ) (need to todo for 4.12)
- Add support for link (DONE)
- Add support for anchor (?)
- Add support for horizontal line (DONE)
- Add support for emoticon (DONE)
- Add support for autocorrection
- Add support for font (DONE)
- Add support for list (DONE)
- Add support for style (DONE)
- Add support for remove format/style (DONE)
- Add supportf for insert html code (DONE)
- Add support for text/background color (DONE)
- Add hmlmode on/off support (in progress) (4.12)
- Add speak support (DONE)
- Add support for find (DONE)
- Add support for replace (in progress) (4.12)
- Restore default font when switch out of html mode (4.12)
- Create a real popup menu (In progress) (4.12)
- Add quote support (4.12)
- Add change text support (4.12)
- Add extra html setting for table/image/link etc. (DONE)
- Add support for resize directly image with mouse. (In progress) (need to fix it for 4.12)
- Add support for resize directly table with mouse. (In progress) (4.12 ?)
- Add support for printing (DONE)
- Add css support ?
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
# Laurent install it if you want to debug it
#add_subdirectory(tests)
add_definitions(-DTRANSLATION_DOMAIN=\"libcomposereditorng\")
set(libcomposereditor_ng_SRCS
composereditor.cpp
composerview.cpp
link/composerlinkdialog.cpp
link/composeranchordialog.cpp
private/composerview_p.cpp
pagecolor/pagecolorbackgrounddialog.cpp
pagecolor/pagecolorbackgroundwidget.cpp
extendattributes/extendattributesdialog.cpp
extendattributes/extendattributesbutton.cpp
extendattributes/extendattributeswidget.cpp
extendattributes/extendattributesutils.cpp
utils/composereditorutils.cpp
image/composerimagedialog.cpp
image/composerimageresizewidget.cpp
table/composertabledialog.cpp
table/composertableresizewidget.cpp
table/composertableformatdialog.cpp
table/composertablecellformatdialog.cpp
table/composertableactionmenu.cpp
table/composercellsizewidget.cpp
image/composerimageresizetooltip.cpp
list/composerlistdialog.cpp
helper/tablehelper.cpp
helper/listhelper.cpp
widgets/domtreewidget.cpp
widgets/findreplacebar.cpp
)
kconfig_add_kcfg_files(libcomposereditor_ng_SRCS
globalsetting_composereditorng.kcfgc
)
ki18n_wrap_ui(libcomposereditor_ng_SRCS ui/pagecolorbackgroundwidget.ui )
ecm_qt_declare_logging_category(libcomposereditor_ng_SRCS HEADER composereditorng_debug.h IDENTIFIER COMPOSEREDITORNG_LOG CATEGORY_NAME log_composereditorng)
add_library(KF5ComposerEditorNG ${libcomposereditor_ng_SRCS})
generate_export_header(KF5ComposerEditorNG BASE_NAME composereditorng)
add_library(KF5::ComposerEditorNG ALIAS KF5ComposerEditorNG)
target_link_libraries(KF5ComposerEditorNG
PRIVATE
KF5::WebKit Qt5::WebKitWidgets KF5::PimTextEdit KF5::SonnetCore KF5::PimCommon KF5::KIOWidgets KF5::XmlGui KF5::Completion Qt5::PrintSupport
)
target_include_directories(KF5ComposerEditorNG INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/ComposerEditorNG/;${KDE_INSTALL_INCLUDEDIR_KF5}/composereditorng>")
target_include_directories(KF5ComposerEditorNG PUBLIC "$<BUILD_INTERFACE:${composereditorng_SOURCE_DIR}/src;${composereditorng_BINARY_DIR}/src>")
set_target_properties(KF5ComposerEditorNG PROPERTIES
VERSION ${COMPOSEREDITORNG_VERSION_STRING}
SOVERSION ${COMPOSEREDITORNG_SOVERSION}
EXPORT_NAME ComposerEditorNG
)
install(TARGETS
KF5ComposerEditorNG
EXPORT KF5ComposerEditorNGTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)
ecm_generate_headers(composereditorng_CamelCase_HEADERS
HEADER_NAMES
ComposerEditor
ComposerView
REQUIRED_HEADERS composereditorng_HEADERS
PREFIX ComposerEditorNG
)
ecm_generate_pri_file(BASE_NAME ComposerEditorNG
LIB_NAME KF5ComposerEditorNG
DEPS "" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/ComposerEditorNG
)
if(${CMAKE_SOURCE_DIR} STREQUAL ${kdepim-apps-lib_SOURCE_DIR})
install(FILES
${composereditorng_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/ComposerEditorNG
COMPONENT Devel
)
install(FILES
${composereditorng_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/composereditorng_export.h
${composereditorng_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/composereditorng
COMPONENT Devel
)
install(FILES
${PRI_FILENAME}
DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif()
install( FILES data/composereditorinitialhtml DESTINATION ${KDE_INSTALL_DATADIR}/composereditor )
#! /bin/sh
$EXTRACTRC `find . -name '*.ui' -o -name '*.kcfg'` >> rc.cpp || exit 11
$XGETTEXT `find . -name '*.h' -o -name '*.cpp' | grep -v '/tests/'` -o $podir/libcomposereditorng.pot
rm -f rc.cpp
<?xml version="1.0" encoding="utf-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile name="composereditor-ngrc" />
<group name="General">
<entry name="AutoSpellChecking" type="Bool" key="auto-spell-checking">
<label></label>
<default>false</default>
</entry>
</group>
</kcfg>
/*
Copyright (c) 2012-2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "composereditor.h"
#include "composerview.h"
#include "widgets/findreplacebar.h"
#include <KToolBar>
#include "composereditorng_debug.h"
#include <QVBoxLayout>
#include <QWebFrame>
namespace ComposerEditorNG
{
class Q_DECL_HIDDEN ComposerEditorPrivate
{
public:
ComposerEditorPrivate(ComposerEditor *qq)
: toolBarLayout(0),
findReplaceBar(0),
q(qq),
view(0),
richTextEnabled(true)
{
}
void initialize()
{
QVBoxLayout *vlay = new QVBoxLayout;
toolBarLayout = new QVBoxLayout;
toolBarLayout->setMargin(0);
vlay->addLayout(toolBarLayout);
vlay->setMargin(0);
vlay->addWidget(view);
findReplaceBar = new FindReplaceBar(view);
vlay->addWidget(findReplaceBar);
q->setLayout(vlay);
q->connect(view, &ComposerView::showFindBar, findReplaceBar, &FindReplaceBar::showAndFocus);
q->connect(view, &ComposerView::openLink, q, &ComposerEditor::openLink);
q->connect(view->page(), &QWebPage::contentsChanged, q, &ComposerEditor::textChanged);
}
KToolBar *createToolBar(const QList<ComposerView::ComposerViewAction> &lstActions)
{
KToolBar *toolbar = new KToolBar(q);
toolbar->setIconSize(QSize(22, 22));
toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
toolBarLayout->addWidget(toolbar);
view->createToolBar(lstActions, toolbar);
listToolBar.append(toolbar);
return toolbar;
}
void showToolBars(bool visible)
{
Q_FOREACH (KToolBar *toolBar, listToolBar) {
toolBar->setVisible(visible);
}
}
QList<KToolBar *> listToolBar;
QVBoxLayout *toolBarLayout;
FindReplaceBar *findReplaceBar;
ComposerEditor *q;
ComposerView *view;
bool richTextEnabled;
};
ComposerEditor::ComposerEditor(ComposerView *view, QWidget *parent)
: QWidget(parent), d(new ComposerEditorPrivate(this))
{
d->view = view;
d->initialize();
}
ComposerEditor::ComposerEditor(QWidget *parent)
: QWidget(parent), d(new ComposerEditorPrivate(this))
{
d->view = new ComposerView(this);
d->initialize();
}
ComposerEditor::~ComposerEditor()
{
//const QString content = d->view->page()->mainFrame()->toHtml();
//qCDebug(COMPOSEREDITORNG_LOG)<<" content :"<<content;
delete d;
}
void ComposerEditor::addCreatedActionsToActionCollection(KActionCollection *actionCollection)
{
d->view->addCreatedActionsToActionCollection(actionCollection);
}
QString ComposerEditor::plainTextContent() const
{
return d->view->page()->mainFrame()->toPlainText();
}
void ComposerEditor::setEnableRichText(bool richTextEnabled)
{
if (d->richTextEnabled != richTextEnabled) {
d->richTextEnabled = richTextEnabled;
d->view->setActionsEnabled(d->richTextEnabled);
d->showToolBars(d->richTextEnabled);
}
}
bool ComposerEditor::enableRichText() const
{
return d->richTextEnabled;
}
bool ComposerEditor::isModified() const
{
return d->view->page()->isModified();
}
void ComposerEditor::paste()
{
d->view->page()->triggerAction(QWebPage::Paste);
}
void ComposerEditor::cut()
{
d->view->page()->triggerAction(QWebPage::Cut);
}
void ComposerEditor::copy()
{
d->view->page()->triggerAction(QWebPage::Copy);
}
void ComposerEditor::undo()
{
d->view->page()->triggerAction(QWebPage::Undo);
}
void ComposerEditor::redo()
{
d->view->page()->triggerAction(QWebPage::Redo);
}
QAction *ComposerEditor::action(QWebPage::WebAction action)
{
return d->view->page()->action(action);
}
ComposerView *ComposerEditor::view() const
{
return d->view;
}
void ComposerEditor::setHtmlContent(const QString &html)
{
d->view->setHtmlContent(html);
}
QString ComposerEditor::htmlContent() const
{
return d->view->page()->mainFrame()->toHtml();
}
void ComposerEditor::createActions(const QList<ComposerView::ComposerViewAction> &lstActions)
{
d->view->createActions(lstActions);
}
void ComposerEditor::createAllActions()
{
d->view->createAllActions();
}
KToolBar *ComposerEditor::createToolBar(const QList<ComposerView::ComposerViewAction> &lstActions)
{
return d->createToolBar(lstActions);
}
void ComposerEditor::addActionInToolBar(QAction *act, KToolBar *toolbar)
{
if (toolbar) {
toolbar->addAction(act);
}
}
QList<KToolBar *> ComposerEditor::toolbars() const
{
return d->listToolBar;
}
QMap<QString, QString> ComposerEditor::localImages() const
{
return d->view->localImages();
}
}
/*
Copyright (c) 2012-2015 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef COMPOSEREDITOR_H
#define COMPOSEREDITOR_H
#include "composereditorng_export.h"
#include "composerview.h"
#include <QWidget>
#include <QWebPage>
class KActionCollection;
class QAction;
namespace ComposerEditorNG
{
class ComposerEditorPrivate;
class ComposerView;
class COMPOSEREDITORNG_EXPORT ComposerEditor : public QWidget
{
Q_OBJECT
public:
Q_PROPERTY(bool enableRichText READ enableRichText WRITE setEnableRichText)
explicit ComposerEditor(QWidget *parent);
explicit ComposerEditor(ComposerView *view, QWidget *parent);
~ComposerEditor();
virtual void addCreatedActionsToActionCollection(KActionCollection *actionCollection);
/**
* @brief createActions create a list of action from default action.
*/
void createActions(const QList<ComposerView::ComposerViewAction> &);
/**
* @brief createAllActions. Create all actions.
*/
void createAllActions();