[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice
From:       Fredy Yanardi <fyanardi () gmail ! com>
Date:       2007-06-30 18:09:51
Message-ID: 1183226991.080114.9644.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 681901 by fyanardi:

add undo support for TextEditingPlugin
CCMAIL: mecirt@gmail.com


 M  +3 -0      libs/kotext/KoTextEditingPlugin.cpp  
 M  +7 -1      libs/kotext/KoTextEditingPlugin.h  
 M  +3 -0      shapes/text/TextTool.cpp  
 M  +3 -2      shapes/text/TextTool.h  


--- trunk/koffice/libs/kotext/KoTextEditingPlugin.cpp #681900:681901
@@ -90,3 +90,6 @@
         block = block.next();
     }
 }
+
+#include "KoTextEditingPlugin.moc"
+
--- trunk/koffice/libs/kotext/KoTextEditingPlugin.h #681900:681901
@@ -19,11 +19,13 @@
 #ifndef KOTEXTEDITINGPLUGIN_H
 #define KOTEXTEDITINGPLUGIN_H
 
+#include <QObject>
 #include <QString>
 #include <kotext_export.h>
 
 class QTextDocument;
 class QTextCursor;
+class QUndoCommand;
 
 /**
  * This is a base class for a text editing plugin as used by the text tool.
@@ -36,7 +38,8 @@
  * a word and then moves the cursor out of the word, a similar approach happens with \
                the
  * finishedParagraph(), it will only be called after the cursor has been moved out \
                of the paragraph.
  */
-class KOTEXT_EXPORT KoTextEditingPlugin {
+class KOTEXT_EXPORT KoTextEditingPlugin : public QObject {
+    Q_OBJECT
 public:
     /// constructor
     KoTextEditingPlugin();
@@ -74,6 +77,9 @@
      */
     virtual void checkSection(QTextDocument *document, int startPosition, int \
endPosition);  
+signals:
+    void commandAvailable(QUndoCommand *command);
+
 protected:
     /**
      * Helper method that allows you to easily get the word out of the document.
--- trunk/koffice/shapes/text/TextTool.cpp #681900:681901
@@ -236,6 +236,9 @@
         m_textEditingPlugins.insert(factory->id(), factory->create());
     }
 
+    foreach (KoTextEditingPlugin* plugin, m_textEditingPlugins.values())
+        connect(plugin, SIGNAL(commandAvailable(QUndoCommand *)), this, \
SLOT(addCommand(QUndoCommand *))); +
     action = new QAction(i18n("Paragraph..."), this);
     addAction("format_paragraph", action);
     action->setShortcut(Qt::ALT + Qt::CTRL + Qt::Key_P);
--- trunk/koffice/shapes/text/TextTool.h #681900:681901
@@ -77,11 +77,12 @@
     /// reimplemented from superclass
     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query, const \
KoViewConverter &converter) const;  
+    void startTextEditingPlugin(const QString &pluginId);
+
+public slots:
     /// add a command to the undo stack, executing it as well.
     void addCommand(QUndoCommand *command);
 
-    void startTextEditingPlugin(const QString &pluginId);
-
 signals:
     /// emitted every time a different styleManager is set.
     void styleManagerChanged(KoStyleManager *manager);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic