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

List:       kde-commits
Subject:    KDE/kdelibs/kate/part
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2006-09-26 13:32:59
Message-ID: 1159277579.723000.4074.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 588608 by cullmann:

shrink interface further, remove QObject, not needed...

 M  +35 -41    kateautoindent.cpp  
 M  +48 -48    kateautoindent.h  
 M  +1 -1      katedocument.cpp  


--- trunk/KDE/kdelibs/kate/part/kateautoindent.cpp #588607:588608
@@ -116,7 +116,7 @@
 }
 
 KateAutoIndent::KateAutoIndent (KateDocument *_doc)
-  : QObject(), doc(_doc)
+  : doc(_doc)
 {
 }
 
@@ -241,50 +241,11 @@
 }
 //END KateAutoIndent
 
-//BEGIN KateViewIndentAction
-KateViewIndentationAction::KateViewIndentationAction(KateDocument *_doc, const \
                QString& text, KActionCollection* parent, const char* name)
-       : KActionMenu (text, parent, name), doc(_doc)
-{
-  connect(menu(),SIGNAL(aboutToShow()),this,SLOT(slotAboutToShow()));
-
-}
-
-void KateViewIndentationAction::slotAboutToShow()
-{
-  QStringList modes = KateAutoIndent::listModes ();
-
-  menu()->clear ();
-  for (int z=0; z<modes.size(); ++z) {
-    QAction *action = menu()->addAction( '&' + \
                KateAutoIndent::modeDescription(z).replace('&', "&&") );
-    action->setCheckable( true );
-    action->setData( z );
-
-    if ( doc->config()->indentationMode() == KateAutoIndent::modeName (z) )
-      action->setChecked( true );
-  }
-
-  disconnect( menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( setMode( QAction* \
                ) ) );
-  connect( menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( setMode( QAction* ) \
                ) );
-}
-
-void KateViewIndentationAction::setMode (QAction *action)
-{
-  // set new mode
-  doc->config()->setIndentationMode(KateAutoIndent::modeName \
                (action->data().toInt()));
-}
-//END KateViewIndentationAction
-
 //BEGIN KateNormalIndent
-KateNormalIndent::KateNormalIndent (KateDocument *_doc)
- : KateAutoIndent (_doc)
+KateNormalIndent::KateNormalIndent (KateDocument *_doc) : KateAutoIndent (_doc)
 {
-  connect(_doc, SIGNAL(highlightingChanged()), this, SLOT(updateConfig()));
 }
 
-KateNormalIndent::~KateNormalIndent ()
-{
-}
-
 void KateNormalIndent::userWrappedLine (KateView *view, const KTextEditor::Cursor \
&position)  {
   kDebug () << "MUHHHHHHHHHH" << endl;
@@ -409,6 +370,39 @@
 QString KateScriptIndent::modeName () { return m_script->internalName (); }
 //END KateScriptIndent
 
+//BEGIN KateViewIndentAction
+KateViewIndentationAction::KateViewIndentationAction(KateDocument *_doc, const \
QString& text, KActionCollection* parent, const char* name) +       : KActionMenu \
(text, parent, name), doc(_doc) +{
+  connect(menu(),SIGNAL(aboutToShow()),this,SLOT(slotAboutToShow()));
+
+}
+
+void KateViewIndentationAction::slotAboutToShow()
+{
+  QStringList modes = KateAutoIndent::listModes ();
+
+  menu()->clear ();
+  for (int z=0; z<modes.size(); ++z) {
+    QAction *action = menu()->addAction( '&' + \
KateAutoIndent::modeDescription(z).replace('&', "&&") ); +    action->setCheckable( \
true ); +    action->setData( z );
+
+    if ( doc->config()->indentationMode() == KateAutoIndent::modeName (z) )
+      action->setChecked( true );
+  }
+
+  disconnect( menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( setMode( QAction* \
) ) ); +  connect( menu(), SIGNAL( triggered( QAction* ) ), this, SLOT( setMode( \
QAction* ) ) ); +}
+
+void KateViewIndentationAction::setMode (QAction *action)
+{
+  // set new mode
+  doc->config()->setIndentationMode(KateAutoIndent::modeName \
(action->data().toInt())); +}
+//END KateViewIndentationAction
+
 //BEGIN ScriptIndentConfigPage, THIS IS ONLY A TEST! :)
 #include <qlabel.h>
 ScriptIndentConfigPage::ScriptIndentConfigPage ( QWidget *parent)
--- trunk/KDE/kdelibs/kate/part/kateautoindent.h #588607:588608
@@ -68,10 +68,8 @@
  * This baseclass is a real dummy, does nothing beside remembering the document it \
                belongs too,
  * only to have the object around
  */
-class KateAutoIndent : public QObject
+class KateAutoIndent
 {
-  Q_OBJECT
-
   /*
    * Static methods to create and list indention modes
    */
@@ -136,7 +134,7 @@
   public:
     /**
      * Constructor
-     * @param doc parent document
+     * \param doc parent document
      */
     KateAutoIndent (KateDocument *doc);
 
@@ -145,17 +143,23 @@
      */
     virtual ~KateAutoIndent ();
 
-  public Q_SLOTS:
+  public:
     /**
      * Update indenter's configuration (indention width, etc.)
+     * Is called in the updateConfig() of the document and after creation of the \
                indenter...
      */
     void updateConfig ();
 
-  /*
-   * Interface for the document
-   * Only generic stuff which needs no overwriting in childclasses
-   */
-  public:
+    /**
+     * Function to provide the common indent/unindent/clean indent functionality to \
the document +     * This should be generic for all indenters, internally it uses the \
doIndent function, +     * in advance it keeps the "keep indent profile" option in \
mind +     * \param view view to work on
+     * \param range range of text to change indent for
+     * \param change level of indents to add or remove, zero will still trigger \
cleaning of indentation +     * and removal of extra spaces, if option set
+     * \return \e true on success, otherwise \e false
+     */
     bool changeIndent (KateView *view, const KTextEditor::Range &range, int change);
 
   /*
@@ -193,6 +197,9 @@
      */
     virtual void userWantsReIndent (KateView *view, const KTextEditor::Range &range) \
{}  
+  /*
+   * Internal helper for the subclasses and itself
+   */
   protected:
     /**
      * Produces a string with the proper indentation characters for its length.
@@ -215,6 +222,9 @@
      */
     bool doIndent ( KateView *view, int line, int change, bool relative, bool \
keepExtraSpaces = false );  
+  /*
+   * needed data
+   */
   protected:
     KateDocument *doc; //!< the document the indenter works on
     int  tabWidth;     //!< The number of characters simulated for a tab
@@ -225,60 +235,27 @@
 };
 
 /**
- * This action provides a list of available indenters and gets plugged
- * into the KateView's KActionCollection.
- */
-class KateViewIndentationAction : public KActionMenu
-{
-  Q_OBJECT
-
-  public:
-    KateViewIndentationAction(KateDocument *_doc, const QString& text, \
                KActionCollection* parent = 0, const char* name = 0);
-
-    ~KateViewIndentationAction(){;};
-
-  private:
-    KateDocument* doc;
-
-  public  Q_SLOTS:
-    void slotAboutToShow();
-
-  private Q_SLOTS:
-    void setMode (QAction*);
-};
-
-/**
  * Provides Auto-Indent functionality for katepart.
  */
 class KateNormalIndent : public KateAutoIndent
 {
-  Q_OBJECT
-
-public:
+  public:
     /**
      * Constructor
      * @param doc parent document
      */
-  KateNormalIndent (KateDocument *doc);
+    KateNormalIndent (KateDocument *doc);
 
     /**
-     * Virtual Destructor for the baseclass
+     * mode name
      */
-  virtual ~KateNormalIndent ();
+    QString modeName () { return QString ("normal"); }
 
-public:
-  virtual void userWrappedLine (KateView *view, const KTextEditor::Cursor \
                &position);
-
-    /**
-     * mode name
-     */
-    virtual QString modeName () { return QString ("normal"); }
+    void userWrappedLine (KateView *view, const KTextEditor::Cursor &position);
 };
 
 class KateScriptIndent : public KateNormalIndent
 {
-  Q_OBJECT
-
   public:
     KateScriptIndent( KateIndentJScript *script, KateDocument *doc );
     ~KateScriptIndent();
@@ -309,6 +286,29 @@
     mutable bool m_canProcessIndent : 1;
 };
 
+/**
+ * This action provides a list of available indenters and gets plugged
+ * into the KateView's KActionCollection.
+ */
+class KateViewIndentationAction : public KActionMenu
+{
+  Q_OBJECT
+
+  public:
+    KateViewIndentationAction(KateDocument *_doc, const QString& text, \
KActionCollection* parent = 0, const char* name = 0); +
+    ~KateViewIndentationAction(){;};
+
+  private:
+    KateDocument* doc;
+
+  public  Q_SLOTS:
+    void slotAboutToShow();
+
+  private Q_SLOTS:
+    void setMode (QAction*);
+};
+
 class ScriptIndentConfigPage : public IndenterConfigPage
 {
   Q_OBJECT
--- trunk/KDE/kdelibs/kate/part/katedocument.cpp #588607:588608
@@ -3017,7 +3017,7 @@
     removeText(KTextEditor::Range(view->cursorPosition(), qMin(buf.length(), \
textLine->length() - view->cursorPosition().column())));  
   insertText(view->cursorPosition(), buf);
- KTextEditor::Cursor b(view->cursorPosition());
+  KTextEditor::Cursor b(view->cursorPosition());
   m_indenter->userTypedChar (view, b, c);
 
   editEnd ();


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

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