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

List:       kde-commits
Subject:    KDE/kdesdk/kate/plugins
From:       Joseph Wenninger <kde () jowenn ! at>
Date:       2007-02-28 22:05:00
Message-ID: 1172700300.728967.20278.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 638122 by jowenn:

Make it compile

 M  +1 -1      CMakeLists.txt  
 M  +1 -1      openheader/kateopenheader.desktop  
 M  +23 -30    openheader/plugin_kateopenheader.cpp  
 M  +12 -3     openheader/plugin_kateopenheader.h  


--- trunk/KDE/kdesdk/kate/plugins/CMakeLists.txt #638121:638122
@@ -14,7 +14,7 @@
 
 #add_subdirectory( htmltools )
 #add_subdirectory( kpybrowser )
-#add_subdirectory( openheader )
+add_subdirectory( openheader )
 #add_subdirectory( textfilter )
 #add_subdirectory( xmltools )
 #add_subdirectory( xmlcheck )
--- trunk/KDE/kdesdk/kate/plugins/openheader/kateopenheader.desktop #638121:638122
@@ -2,6 +2,6 @@
 Type=Service
 ServiceTypes=Kate/Plugin
 X-KDE-Library=kateopenheaderplugin
-X-Kate-Version=2.9
+X-Kate-Version=2.8
 Name=Kate OpenHeader
 Comment=Opens the corresponding .h/[.cpp|.c] file
--- trunk/KDE/kdesdk/kate/plugins/openheader/plugin_kateopenheader.cpp #638121:638122
@@ -30,16 +30,30 @@
 #include <kurl.h>
 #include <kio/netaccess.h>
 #include <kactioncollection.h>
-class PluginView : public KXMLGUIClient
-{
-  friend class PluginKateOpenHeader;
 
-  public:
-    Kate::MainWindow *win;
-};
 
 K_EXPORT_COMPONENT_FACTORY( kateopenheaderplugin, \
KGenericFactory<PluginKateOpenHeader>( "kateopenheader" ) )  
+
+PluginViewKateOpenHeader::PluginViewKateOpenHeader(PluginKateOpenHeader \
*plugin,Kate::MainWindow *mainwindow): Kate::PluginView(mainwindow),KXMLGUIClient() \
+{ +    QAction *a = actionCollection()->addAction("file_openheader");
+    a->setText(i18n("Open .h/.cpp/.c"));
+    a->setShortcut( Qt::Key_F12 );
+    connect( a, SIGNAL( triggered(bool) ), plugin, SLOT( slotOpenHeader() ) );
+
+    setComponentData (KComponentData("kate"));
+    setXMLFile( "plugins/kateopenheader/ui.rc" );
+    mainwindow->guiFactory()->addClient (this);
+}
+
+PluginViewKateOpenHeader::~PluginViewKateOpenHeader()
+{
+      mainWindow()->guiFactory()->removeClient (this);
+
+}
+
+
 PluginKateOpenHeader::PluginKateOpenHeader( QObject* parent, const QStringList& )
     : Kate::Plugin ( (Kate::Application *)parent, "open-header-plugin" )
 {
@@ -49,35 +63,14 @@
 {
 }
 
-void PluginKateOpenHeader::addView(Kate::MainWindow *win)
+Kate::PluginView *PluginKateOpenHeader::createView (Kate::MainWindow *mainWindow)
 {
-    PluginView *view = new PluginView ();
+    return new PluginViewKateOpenHeader(this,mainWindow);
+}
 
-    QAction *a = view->actionCollection()->addAction("file_openheader");
-    a->setText(i18n("Open .h/.cpp/.c"));
-    a->setShortcut( Qt::Key_F12 );
-    connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotOpenHeader() ) );
 
-    view->setComponentData (KComponentData("kate"));
-    view->setXMLFile( "plugins/kateopenheader/ui.rc" );
-    win->guiFactory()->addClient (view);
-    view->win = win;
 
-   m_views.append (view);
-}
 
-void PluginKateOpenHeader::removeView(Kate::MainWindow *win)
-{
-  for (int z=0; z < m_views.count(); z++)
-    if (m_views.at(z)->win == win)
-    {
-      PluginView *view = m_views.at(z);
-      m_views.removeAll (view);
-      win->guiFactory()->removeClient (view);
-      delete view;
-    }
-}
-
 void PluginKateOpenHeader::storeGeneralConfig(KConfig* config,const QString& \
groupPrefix)  {
   Q_UNUSED( config );
--- trunk/KDE/kdesdk/kate/plugins/openheader/plugin_kateopenheader.h #638121:638122
@@ -20,10 +20,11 @@
 
 #include <kate/plugin.h>
 #include <kate/mainwindow.h>
+#include <kxmlguiclient.h>
 
 #include <QList>
 
-class PluginKateOpenHeader : public Kate::Plugin, Kate::PluginViewInterface
+class PluginKateOpenHeader : public Kate::Plugin
 {
   Q_OBJECT
 
@@ -31,9 +32,9 @@
     PluginKateOpenHeader( QObject* parent = 0, const QStringList& = QStringList() );
     virtual ~PluginKateOpenHeader();
 
-    void addView (Kate::MainWindow *win);
-    void removeView (Kate::MainWindow *win);
+    Kate::PluginView *createView (Kate::MainWindow *mainWindow);
 
+
     void storeGeneralConfig(KConfig* config,const QString& groupPrefix);
     void loadGeneralConfig(KConfig* config,const QString& groupPrefix);
 
@@ -48,4 +49,12 @@
   QList<class PluginView*> m_views;
 };
 
+class PluginViewKateOpenHeader: public Kate::PluginView, KXMLGUIClient {
+    Q_OBJECT
+    public:
+        PluginViewKateOpenHeader(PluginKateOpenHeader* plugin, Kate::MainWindow \
*mainwindow); +        virtual ~PluginViewKateOpenHeader();
+};
+
+
 #endif // _PLUGIN_KANT_OPENHEADER_H


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

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