[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim] composereditor-ng: Move table action in composertableactionmenu
From: Montel Laurent <montel () kde ! org>
Date: 2012-12-18 19:50:58
Message-ID: 20121218195058.BFB7EA6091 () git ! kde ! org
[Download RAW message or body]
Git commit 01f8de0628779fdb45a33b061221f9b8d25610cc by Montel Laurent.
Committed on 18/12/2012 at 20:50.
Pushed by mlaurent into branch 'master'.
Move table action in composertableactionmenu
M +73 -7 composereditor-ng/composertableactionmenu.cpp
M +12 -3 composereditor-ng/composertableactionmenu.h
M +8 -22 composereditor-ng/composerview.cpp
M +0 -2 composereditor-ng/composerview.h
http://commits.kde.org/kdepim/01f8de0628779fdb45a33b061221f9b8d25610cc
diff --git a/composereditor-ng/composertableactionmenu.cpp \
b/composereditor-ng/composertableactionmenu.cpp index 4405f85..e1d0096 100644
--- a/composereditor-ng/composertableactionmenu.cpp
+++ b/composereditor-ng/composertableactionmenu.cpp
@@ -19,21 +19,85 @@
*/
#include "composertableactionmenu.h"
+#include "composertablecellformatdialog.h"
+#include "composertableformatdialog.h"
+#include "composereditorutil_p.h"
+
+#include <KLocale>
+
+#include <QWebElement>
+
namespace ComposerEditorNG
{
class ComposerTableActionMenuPrivate
{
public:
- ComposerTableActionMenuPrivate(ComposerTableActionMenu *qq)
- : q( qq )
- {
- }
- ComposerTableActionMenu *q;
+ ComposerTableActionMenuPrivate(QWidget *parent, const QWebElement& element, \
ComposerTableActionMenu *qq) + : q( qq ), webElement(element), \
parentWidget(parent) + {
+ }
+ void _k_slotInsertRowBelow();
+ void _k_slotTableFormat();
+ void _k_slotTableCellFormat();
+
+ void updateActions();
+ KAction *action_insert_table;
+ KAction *action_insert_row_below;
+ KAction *action_table_format;
+ KAction *action_table_cell_format;
+ ComposerTableActionMenu *q;
+ QWebElement webElement;
+ QWidget *parentWidget;
};
-ComposerTableActionMenu::ComposerTableActionMenu(KActionCollection *ac, QWidget \
*parent)
- : KActionMenu(parent), d(new ComposerTableActionMenuPrivate(this))
+void ComposerTableActionMenuPrivate::updateActions()
+{
+ //TODO
+}
+
+void ComposerTableActionMenuPrivate::_k_slotInsertRowBelow()
+{
+ //TODO
+}
+
+void ComposerTableActionMenuPrivate::_k_slotTableFormat()
{
+ ComposerTableFormatDialog dlg( Util::tableWebElement(webElement),parentWidget );
+ dlg.exec();
+}
+
+void ComposerTableActionMenuPrivate::_k_slotTableCellFormat()
+{
+ ComposerTableCellFormatDialog dlg( webElement,parentWidget );
+ dlg.exec();
+}
+
+ComposerTableActionMenu::ComposerTableActionMenu(const QWebElement& element,QObject \
*parent, QWidget *view) + : KActionMenu(parent), d(new \
ComposerTableActionMenuPrivate(view, element, this)) +{
+ setText( i18n( "Table" ) );
+
+ KActionMenu *insertMenu = new KActionMenu( i18n( "Insert" ), this );
+ addAction( insertMenu );
+
+ d->action_insert_table = new KAction( i18n( "Table..." ), this );
+ insertMenu->addAction( d->action_insert_table );
+ connect( d->action_insert_table, SIGNAL(triggered(bool)), \
SIGNAL(insertNewTable()) ); +
+ insertMenu->addSeparator();
+ d->action_insert_row_below = new KAction( i18n( "Row Below" ), this );
+ insertMenu->addAction( d->action_insert_row_below );
+ connect( d->action_insert_row_below, SIGNAL(triggered(bool)), \
SLOT(_k_slotInsertRowBelow()) ); +
+ d->action_table_format = new KAction( i18n( "Table Format..." ), this );
+ connect( d->action_table_format, SIGNAL(triggered(bool)), \
SLOT(_k_slotTableFormat()) ); + addAction( d->action_table_format );
+
+ d->action_table_cell_format = new KAction( i18n( "Table Cell Format..." ), this \
); + connect( d->action_table_cell_format, SIGNAL(triggered(bool)), \
SLOT(_k_slotTableCellFormat()) ); + addAction( d->action_table_cell_format );
+
+ d->updateActions();
}
ComposerTableActionMenu::~ComposerTableActionMenu()
@@ -42,3 +106,5 @@ ComposerTableActionMenu::~ComposerTableActionMenu()
}
}
+
+#include "composertableactionmenu.moc"
diff --git a/composereditor-ng/composertableactionmenu.h \
b/composereditor-ng/composertableactionmenu.h index f41e337..6281526 100644
--- a/composereditor-ng/composertableactionmenu.h
+++ b/composereditor-ng/composertableactionmenu.h
@@ -22,8 +22,7 @@
#define COMPOSERTABLEACTIONMENU_H
#include <KActionMenu>
-
-class KActionCollection;
+class QWebElement;
namespace ComposerEditorNG
{
@@ -32,12 +31,22 @@ class ComposerTableActionMenu : public KActionMenu
{
Q_OBJECT
public:
- explicit ComposerTableActionMenu(KActionCollection *ac, QWidget *parent);
+ explicit ComposerTableActionMenu(const QWebElement &element, QObject *parent, \
QWidget *view); ~ComposerTableActionMenu();
+Q_SIGNALS:
+ /**
+ * @brief insertNewTable, send signal to insert new table
+ */
+ void insertNewTable();
+
+
private:
friend class ComposerTableActionMenuPrivate;
ComposerTableActionMenuPrivate * const d;
+ Q_PRIVATE_SLOT( d, void _k_slotInsertRowBelow() )
+ Q_PRIVATE_SLOT( d, void _k_slotTableFormat() )
+ Q_PRIVATE_SLOT( d, void _k_slotTableCellFormat() )
};
}
diff --git a/composereditor-ng/composerview.cpp b/composereditor-ng/composerview.cpp
index 6915ab7..317adbd 100644
--- a/composereditor-ng/composerview.cpp
+++ b/composereditor-ng/composerview.cpp
@@ -27,6 +27,7 @@
#include "composertabledialog.h"
#include "composertableformatdialog.h"
#include "composertablecellformatdialog.h"
+#include "composertableactionmenu.h"
#include <kpimtextedit/emoticontexteditaction.h>
#include <kpimtextedit/inserthtmldialog.h>
@@ -122,8 +123,6 @@ public:
void _k_slotToggleBlockQuote();
void _k_slotEditImage();
void _k_slotSaveAs();
- void _k_slotEditTable();
- void _k_slotEditTableCell();
QAction* getAction ( QWebPage::WebAction action ) const;
QVariant evaluateJavascript(const QString& command);
@@ -329,18 +328,6 @@ void ComposerViewPrivate::_k_slotInsertTable()
delete dlg;
}
-void ComposerViewPrivate::_k_slotEditTable()
-{
- ComposerTableFormatDialog dlg( \
Util::tableWebElement(contextMenuResult.element()),q );
- dlg.exec();
-}
-
-void ComposerViewPrivate::_k_slotEditTableCell()
-{
- ComposerTableCellFormatDialog dlg( contextMenuResult.element(),q );
- dlg.exec();
-}
-
void ComposerViewPrivate::_k_slotInsertHorizontalRule()
{
execCommand(QLatin1String("insertHTML"), QLatin1String("<hr>"));
@@ -882,16 +869,15 @@ void ComposerView::contextMenuEvent(QContextMenuEvent* event)
QAction *editLinkAction = menu->addAction(i18n("Edit Link..."));
connect( editLinkAction, SIGNAL(triggered(bool)), this, \
SLOT(_k_slotEditLink()) ); } else if(tableSelected) {
- QAction *editTableAction = menu->addAction(i18n("Edit Table..."));
- connect( editTableAction, SIGNAL(triggered(bool)), this, \
SLOT(_k_slotEditTable()) );
- if(tableCellSelected) {
- QAction *editTableCellAction = menu->addAction(i18n("Edit Cell..."));
- connect( editTableCellAction, SIGNAL(triggered(bool)), this, \
SLOT(_k_slotEditTableCell()) );
- }
+ ComposerTableActionMenu * tableActionMenu = new \
ComposerTableActionMenu(elm,menu,this); + \
connect(tableActionMenu,SIGNAL(insertNewTable()),SLOT(_k_slotInsertTable())); + \
menu->addAction(tableActionMenu); }
menu->addSeparator();
- menu->addAction(d->action_spell_check);
- menu->addSeparator();
+ if(!emptyDocument) {
+ menu->addAction(d->action_spell_check);
+ menu->addSeparator();
+ }
QAction *speakAction = menu->addAction(i18n("Speak Text"));
speakAction->setIcon(KIcon(QLatin1String("preferences-desktop-text-to-speech")));
diff --git a/composereditor-ng/composerview.h b/composereditor-ng/composerview.h
index 14edf6a..12e5d33 100644
--- a/composereditor-ng/composerview.h
+++ b/composereditor-ng/composerview.h
@@ -77,9 +77,7 @@ private:
Q_PRIVATE_SLOT( d, void _k_slotEditLink() )
Q_PRIVATE_SLOT( d, void _k_slotToggleBlockQuote() )
Q_PRIVATE_SLOT( d, void _k_slotEditImage() )
- Q_PRIVATE_SLOT( d, void _k_slotEditTable() )
Q_PRIVATE_SLOT( d, void _k_slotSaveAs() )
- Q_PRIVATE_SLOT( d, void _k_slotEditTableCell() )
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic