All pastes #386349 Raw Edit

kdelibs.diff

public text v1 · immutable
·published 2007-03-08 15:20 UTC
rendered paste body
Index: interfaces/ktexteditor/editor.h
===================================================================
--- interfaces/ktexteditor/editor.h	(revisione 612592)
+++ interfaces/ktexteditor/editor.h	(copia locale)
@@ -229,7 +229,7 @@
      * something like "Shortcut Configuration".
      * \param number index of config page
      * \return full name of given page index
-	 * \see configPageName(), configPagePixmap()
+     * \see configPageName(), configPagePixmap()
      */
     virtual QString configPageFullName (int number) const = 0;
 
@@ -241,6 +241,15 @@
      */
     virtual KIcon configPageIcon (int number) const = 0;
 
+  /*
+   * Debug
+   */
+  public:
+    /**
+     * sDebugScript Signal wrapper
+     */
+    virtual void debugScript(const QString&) = 0;
+
   Q_SIGNALS:
     /**
      * The \p editor emits this signal whenever a \p document was successfully
@@ -252,6 +261,11 @@
     void documentCreated (KTextEditor::Editor *editor,
                           KTextEditor::Document *document);
 
+    /**
+     * The \p sDebugScript emits the script debug message
+     */
+    void sDebugScript(const QString&);
+
   private:
     class EditorPrivate* const d;
 };
Index: kate/part/kateglobal.h
===================================================================
--- kate/part/kateglobal.h	(revisione 612592)
+++ kate/part/kateglobal.h	(copia locale)
@@ -153,6 +153,16 @@
     KIcon configPageIcon (int number) const;
 
   /**
+   * Debug
+   */
+  public:
+    /**
+     * Emit debug message via \p sDebugScript signal
+     * \param message the message to be emitted
+     */
+    void debugScript(const QString& message);
+
+  /**
    * Kate Part Internal stuff ;)
    */
   public:
@@ -317,6 +327,10 @@
      */
     QStringList commandList() const;
 
+  //Q_SLOTS:
+  public slots:
+    void myTestSlot(const QString&);
+
   private:
     /**
      * instance of this factory
Index: kate/part/katejscript.cpp
===================================================================
--- kate/part/katejscript.cpp	(revisione 612592)
+++ kate/part/katejscript.cpp	(copia locale)
@@ -159,9 +159,10 @@
 
 JSValue* KateJSGlobalFunctions::callAsFunction (KJS::ExecState *exec, KJS::JSObject *thisObj, const KJS::List &args)
 {
+  //const QString a, b;
   switch (id) {
     case Debug:
-      kDebug(13051) << args[0]->toString(exec).qstring() << endl;
+      KateGlobal::self()->debugScript(args[0]->toString(exec).qstring());
       return KJS::Undefined();
     default:
       break;
Index: kate/part/kateglobal.cpp
===================================================================
--- kate/part/kateglobal.cpp	(revisione 612592)
+++ kate/part/kateglobal.cpp	(copia locale)
@@ -143,6 +143,9 @@
 
   for ( QList<KTextEditor::Command *>::iterator it = m_cmds.begin(); it != m_cmds.end(); ++it )
     m_cmdManager->registerCommand (*it);
+
+  QObject::connect(this, SIGNAL(sDebugScript(QString)),
+                      this, SLOT(myTestSlot(QString)));
 }
 
 KateGlobal::~KateGlobal()
@@ -453,6 +456,11 @@
   return KIcon("edit");
 }
 
+void KateGlobal::debugScript(const QString& message)
+{
+  sDebugScript(message);
+}
+
 KateGlobal *KateGlobal::self ()
 {
   if (!s_self) {
@@ -505,5 +513,10 @@
 {return m_cmdManager->commandList();}
 //END command interface
 
+void KateGlobal::myTestSlot(const QString& str)
+{
+  kDebug(13051) << str << endl;
+}
 
+
 // kate: space-indent on; indent-width 2; replace-tabs on;