[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim] /: Move in own directory
From: Montel Laurent <montel () kde ! org>
Date: 2015-09-02 5:59:59
Message-ID: E1ZX15T-0001cl-Uo () scm ! kde ! org
[Download RAW message or body]
Git commit 2426373de69d74966f71d75736d532a7f21b4126 by Montel Laurent.
Committed on 02/09/2015 at 05:04.
Pushed by mlaurent into branch 'master'.
Move in own directory
M +1 -1 blogilo/src/composer/blogilocomposerview.cpp
M +1 -1 blogilo/src/composer/blogilocomposerwidget.h
M +1 -1 kmail/editor/kmcomposewin.cpp
M +6 -2 pimcommon/CMakeLists.txt
A +47 -0 pimcommon/customtools/customtoolsabstract.cpp [License: GPL (v2)]
A +49 -0 pimcommon/customtools/customtoolsabstract.h [License: GPL (v2)]
A +168 -0 pimcommon/customtools/customtoolswidget.cpp [License: GPL (v2)]
A +68 -0 pimcommon/customtools/customtoolswidget.h [License: GPL (v2)]
M +1 -1 pimcommon/widgets/tests/customtoolswidget_gui.cpp
http://commits.kde.org/kdepim/2426373de69d74966f71d75736d532a7f21b4126
diff --git a/blogilo/src/composer/blogilocomposerview.cpp \
b/blogilo/src/composer/blogilocomposerview.cpp index 9dcb07c..7bc77d6 100644
--- a/blogilo/src/composer/blogilocomposerview.cpp
+++ b/blogilo/src/composer/blogilocomposerview.cpp
@@ -18,7 +18,7 @@
*/
#include "blogilocomposerview.h"
-#include "pimcommon/widgets/customtoolswidget.h"
+#include "pimcommon/customtools/customtoolswidget.h"
#include <KToggleAction>
diff --git a/blogilo/src/composer/blogilocomposerwidget.h \
b/blogilo/src/composer/blogilocomposerwidget.h index 7796065..adf1040 100644
--- a/blogilo/src/composer/blogilocomposerwidget.h
+++ b/blogilo/src/composer/blogilocomposerwidget.h
@@ -22,7 +22,7 @@
#define BLOGILOCOMPOSERWIDGET_H
#include <QWidget>
-#include "pimcommon/widgets/customtoolswidget.h"
+#include "pimcommon/customtools/customtoolswidget.h"
class BlogiloComposerEditor;
class BlogiloComposerView;
class BlogiloComposerWidget : public QWidget
diff --git a/kmail/editor/kmcomposewin.cpp b/kmail/editor/kmcomposewin.cpp
index cebd955..b887c2e 100644
--- a/kmail/editor/kmcomposewin.cpp
+++ b/kmail/editor/kmcomposewin.cpp
@@ -55,7 +55,7 @@
#include "custommimeheader.h"
#include "pimcommon/autocorrection/widgets/lineeditwithautocorrection.h"
#include "pimcommon/translator/translatorwidget.h"
-#include "pimcommon/widgets/customtoolswidget.h"
+#include "pimcommon/customtools/customtoolswidget.h"
#include "warningwidgets/attachmentmissingwarning.h"
#include "job/createnewcontactjob.h"
#include "job/savedraftjob.h"
diff --git a/pimcommon/CMakeLists.txt b/pimcommon/CMakeLists.txt
index 4bb6482..8ed3060 100644
--- a/pimcommon/CMakeLists.txt
+++ b/pimcommon/CMakeLists.txt
@@ -163,7 +163,6 @@ set(libpimcommon_widgets_SRCS
widgets/simplestringlisteditor.cpp
widgets/customtextedit.cpp
widgets/customtreeview.cpp
- widgets/customtoolswidget.cpp
widgets/configureimmutablewidgetutils.cpp
widgets/slidecontainer.cpp
widgets/emailaddressrequester.cpp
@@ -172,7 +171,11 @@ set(libpimcommon_widgets_SRCS
widgets/kactionmenuchangecase.cpp
widgets/lineeditwithcompleter.cpp
widgets/spellchecklineedit.cpp
- widgets/customtoolsabstract.cpp
+)
+
+set(libpimcommon_customtools_SRCS
+ customtools/customtoolsabstract.cpp
+ customtools/customtoolswidget.cpp
)
set(libtexttospeech_SRCS
@@ -255,6 +258,7 @@ set(libpimcommon_SRCS
${libpimcommon_baloodebug_SRCS}
${libpimcommon_temporary_SRCS}
${libpimcommon_gravatar_SRCS}
+ ${libpimcommon_customtools_SRCS}
)
ecm_qt_declare_logging_category(libpimcommon_SRCS HEADER pimcommon_debug.h \
IDENTIFIER PIMCOMMON_LOG CATEGORY_NAME log_pimcommon)
diff --git a/pimcommon/customtools/customtoolsabstract.cpp \
b/pimcommon/customtools/customtoolsabstract.cpp new file mode 100644
index 0000000..98a053663
--- /dev/null
+++ b/pimcommon/customtools/customtoolsabstract.cpp
@@ -0,0 +1,47 @@
+/*
+ Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "customtoolsabstract.h"
+
+using namespace PimCommon;
+
+class PimCommon::CustomToolsAbstractPrivate
+{
+public:
+ CustomToolsAbstractPrivate()
+ {
+
+ }
+};
+
+CustomToolsAbstract::CustomToolsAbstract(QObject *parent)
+ : QObject(parent),
+ d(new PimCommon::CustomToolsAbstractPrivate)
+{
+
+}
+
+
+CustomToolsAbstract::~CustomToolsAbstract()
+{
+ delete d;
+}
+
+void CustomToolsAbstract::setShortcut(KActionCollection *ac)
+{
+ Q_UNUSED(ac);
+}
diff --git a/pimcommon/customtools/customtoolsabstract.h \
b/pimcommon/customtools/customtoolsabstract.h new file mode 100644
index 0000000..046b355
--- /dev/null
+++ b/pimcommon/customtools/customtoolsabstract.h
@@ -0,0 +1,49 @@
+/*
+ Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef CUSTOMTOOLSABSTRACT_H
+#define CUSTOMTOOLSABSTRACT_H
+
+#include "pimcommon/pimcommon_export.h"
+#include <QObject>
+class KToggleAction;
+class KActionCollection;
+namespace PimCommon
+{
+class CustomToolsAbstractPrivate;
+class PIMCOMMON_EXPORT CustomToolsAbstract : public QObject
+{
+ Q_OBJECT
+public:
+ explicit CustomToolsAbstract(QObject *parent = Q_NULLPTR);
+ ~CustomToolsAbstract();
+
+ virtual KToggleAction *action() const = 0;
+ virtual QWidget *createView() = 0;
+
+ virtual void setShortcut(KActionCollection *ac);
+
+Q_SIGNALS:
+ void customToolsWasClosed();
+ void activateTool(QWidget *);
+ void insertText(const QString &);
+
+private:
+ CustomToolsAbstractPrivate *const d;
+};
+}
+#endif // CUSTOMTOOLSABSTRACT_H
diff --git a/pimcommon/customtools/customtoolswidget.cpp \
b/pimcommon/customtools/customtoolswidget.cpp new file mode 100644
index 0000000..db114c3
--- /dev/null
+++ b/pimcommon/customtools/customtoolswidget.cpp
@@ -0,0 +1,168 @@
+/*
+ Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "customtoolswidget.h"
+
+#include "pimcommon/shorturl/shorturlwidget.h"
+#include "pimcommon/translator/translatorwidget.h"
+
+#include <KToggleAction>
+
+#include <QHBoxLayout>
+#include <QStackedWidget>
+#include "pimcommon_debug.h"
+
+using namespace PimCommon;
+class PimCommon::CustomToolsWidgetPrivate
+{
+public:
+ CustomToolsWidgetPrivate()
+ : mStackedWidget(Q_NULLPTR),
+ mShortUrlWidget(Q_NULLPTR),
+ mTranslatorWidget(Q_NULLPTR)
+ {
+
+ }
+ QStackedWidget *mStackedWidget;
+ ShortUrlWidget *mShortUrlWidget;
+ TranslatorWidget *mTranslatorWidget;
+};
+
+CustomToolsWidget::CustomToolsWidget(QWidget *parent, KActionCollection *ac)
+ : QWidget(parent),
+ d(new PimCommon::CustomToolsWidgetPrivate)
+{
+ QHBoxLayout *lay = new QHBoxLayout;
+ d->mStackedWidget = new QStackedWidget;
+ lay->addWidget(d->mStackedWidget);
+ setLayout(lay);
+
+ d->mShortUrlWidget = new ShortUrlWidget;
+ d->mTranslatorWidget = new TranslatorWidget;
+ d->mShortUrlWidget->setStandalone(false);
+ d->mTranslatorWidget->setStandalone(false);
+ d->mStackedWidget->addWidget(d->mShortUrlWidget);
+ d->mStackedWidget->addWidget(d->mTranslatorWidget);
+
+ d->mShortUrlWidget->createAction(ac);
+ d->mTranslatorWidget->createAction(ac);
+
+ connect(d->mShortUrlWidget, &ShortUrlWidget::shortUrlWasClosed, this, \
&CustomToolsWidget::slotHideTools); + connect(d->mShortUrlWidget->toggleAction(), \
&KToggleAction::triggered, this, &CustomToolsWidget::slotVisibleShortUrlTools); +
+ connect(d->mTranslatorWidget, &TranslatorWidget::translatorWasClosed, this, \
&CustomToolsWidget::slotHideTools); + \
connect(d->mTranslatorWidget->toggleAction(), &KToggleAction::triggered, this, \
&CustomToolsWidget::slotVisibleTranslatorTools); +
+ connect(d->mShortUrlWidget, &ShortUrlWidget::shortUrlWasClosed, this, \
&CustomToolsWidget::shortUrlWasClosed); + connect(d->mShortUrlWidget, \
&ShortUrlWidget::insertShortUrl, this, &CustomToolsWidget::insertShortUrl); +
+ connect(d->mTranslatorWidget, &TranslatorWidget::translatorWasClosed, this, \
&CustomToolsWidget::translatorWasClosed); +
+ d->mStackedWidget->setCurrentWidget(d->mTranslatorWidget);
+ hide();
+}
+
+CustomToolsWidget::~CustomToolsWidget()
+{
+ delete d;
+}
+
+void CustomToolsWidget::slotVisibleTranslatorTools(bool b)
+{
+ if (b) {
+ switchToTool(PimCommon::CustomToolsWidget::TranslatorTool);
+ } else {
+ customToolWasClosed();
+ }
+ setVisible(b);
+}
+
+void CustomToolsWidget::slotVisibleShortUrlTools(bool b)
+{
+ if (b) {
+ switchToTool(PimCommon::CustomToolsWidget::ShortUrlTool);
+ } else {
+ customToolWasClosed();
+ }
+ setVisible(b);
+}
+
+void CustomToolsWidget::customToolWasClosed()
+{
+ d->mShortUrlWidget->toggleAction()->setChecked(false);
+ d->mTranslatorWidget->toggleAction()->setChecked(false);
+}
+
+TranslatorWidget *CustomToolsWidget::translatorWidget() const
+{
+ return d->mTranslatorWidget;
+}
+
+KToggleAction *CustomToolsWidget::action(CustomToolsWidget::ToolType type)
+{
+ KToggleAction *act = Q_NULLPTR;
+ switch (type) {
+ case TranslatorTool:
+ act = d->mTranslatorWidget->toggleAction();
+ break;
+ case ShortUrlTool:
+ act = d->mShortUrlWidget->toggleAction();
+ break;
+ default:
+ qCDebug(PIMCOMMON_LOG) << " type unknown :" << type;
+ break;
+ }
+ return act;
+}
+
+void CustomToolsWidget::switchToTool(CustomToolsWidget::ToolType type)
+{
+ switch (type) {
+ case TranslatorTool:
+ d->mStackedWidget->setCurrentWidget(d->mTranslatorWidget);
+ d->mShortUrlWidget->toggleAction()->setChecked(false);
+ break;
+ case ShortUrlTool:
+ d->mStackedWidget->setCurrentWidget(d->mShortUrlWidget);
+ d->mTranslatorWidget->toggleAction()->setChecked(false);
+ break;
+ default:
+ qCDebug(PIMCOMMON_LOG) << " type unknown :" << type;
+ break;
+ }
+ Q_EMIT toolSwitched(type);
+}
+
+CustomToolsWidget::ToolType CustomToolsWidget::toolType() const
+{
+ if (d->mStackedWidget->currentWidget() == d->mTranslatorWidget) {
+ return TranslatorTool;
+ } else if (d->mStackedWidget->currentWidget() == d->mShortUrlWidget) {
+ return ShortUrlTool;
+ } else {
+ qCDebug(PIMCOMMON_LOG) << " unknown tool";
+ return TranslatorTool;
+ }
+}
+
+void CustomToolsWidget::slotHideTools()
+{
+ customToolWasClosed();
+ hide();
+}
+
+#include "moc_customtoolswidget.cpp"
diff --git a/pimcommon/customtools/customtoolswidget.h \
b/pimcommon/customtools/customtoolswidget.h new file mode 100644
index 0000000..ddff856
--- /dev/null
+++ b/pimcommon/customtools/customtoolswidget.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef CUSTOMTOOLSWIDGET_H
+#define CUSTOMTOOLSWIDGET_H
+
+#include "pimcommon/pimcommon_export.h"
+
+#include <QWidget>
+class KToggleAction;
+class QStackedWidget;
+class KActionCollection;
+namespace PimCommon
+{
+class ShortUrlWidget;
+class TranslatorWidget;
+class CustomToolsWidgetPrivate;
+class PIMCOMMON_EXPORT CustomToolsWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ enum ToolType {
+ TranslatorTool = 0,
+ ShortUrlTool = 1
+ };
+
+ explicit CustomToolsWidget(QWidget *parent = Q_NULLPTR, KActionCollection *ac = \
Q_NULLPTR); + ~CustomToolsWidget();
+
+ void switchToTool(CustomToolsWidget::ToolType type);
+
+ CustomToolsWidget::ToolType toolType() const;
+
+ KToggleAction *action(CustomToolsWidget::ToolType type);
+
+ TranslatorWidget *translatorWidget() const;
+
+private Q_SLOTS:
+ void slotHideTools();
+ void slotVisibleShortUrlTools(bool b);
+ void slotVisibleTranslatorTools(bool b);
+
+Q_SIGNALS:
+ void shortUrlWasClosed();
+ void toolSwitched(PimCommon::CustomToolsWidget::ToolType type);
+ void translatorWasClosed();
+ void insertShortUrl(const QString &url);
+
+private:
+ void customToolWasClosed();
+ CustomToolsWidgetPrivate *const d;
+};
+}
+#endif // CUSTOMTOOLSWIDGET_H
diff --git a/pimcommon/widgets/tests/customtoolswidget_gui.cpp \
b/pimcommon/widgets/tests/customtoolswidget_gui.cpp index 5157b91..7e7bc36 100644
--- a/pimcommon/widgets/tests/customtoolswidget_gui.cpp
+++ b/pimcommon/widgets/tests/customtoolswidget_gui.cpp
@@ -16,7 +16,7 @@
*/
#include "customtoolswidget_gui.h"
-#include "pimcommon/widgets/customtoolswidget.h"
+#include "pimcommon/customtools/customtoolswidget.h"
#include <QStandardPaths>
#include <KLocalizedString>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic