Commits

Anonymous committed d9184c1

first steps to a plugin config dialog page

svn path=/trunk/kdelibs/kate/; revision=157926

Comments (0)

Files changed (4)

part/part/katedialogs.cpp

 #include <qvgroupbox.h>
 #include <qwhatsthis.h>
 #include <qwidgetstack.h>
+#include <katefactory.h>
 
 
 #include "hlparamedit.h"
 #define TAG_INT "Int"
 #define TAG_FLOAT "Float"
 #define TAG_KEYWORD "keyword"
+       
+class PluginListItem : public QCheckListItem
+{          
+  public:
+    PluginListItem (KListView * parent, const QString & text) : QCheckListItem ( parent, text )  {};
+
+  public:
+    QString libname; 
+};
+                                             
+PluginListView::PluginListView (QWidget *parent, bool docPlugins, KateDocument *doc, KTrader::OfferList *plugins)
+  : KListView (parent), m_docPlugins (docPlugins), m_doc (doc), m_plugins (plugins) 
+{
+  if (docPlugins)
+  {
+    KTrader::OfferList::Iterator it(m_plugins->begin());
+    for( ; it != m_plugins->end(); ++it)
+    {
+      KService::Ptr ptr = (*it); 
+      
+      PluginListItem *item = new PluginListItem (this, "test");
+           
+         
+      insertItem (item);
+      
+  /*    if (m_doc->loadedPlugins.find (QFile::encodeName(ptr->library())) > -1)
+      {
+      }*/
+    }
+  }
+
+
+}
+
+PluginListView::~PluginListView ()
+{
+}
+
+
+ PluginConfigPage::PluginConfigPage (QWidget *parent, KateDocument *doc) : Kate::ConfigPage (parent, "")
+{
+  m_doc = doc;
+  
+  // sizemanagment
+  QGridLayout *grid = new QGridLayout( this, 1, 1 );
+
+  QTabWidget *tab = new QTabWidget (this);
+  tab->setMargin(KDialog::marginHint());
+  grid->addWidget( tab, 0, 0);
+
+  m_docPlugins = new PluginListView (tab, true, m_doc, KateFactory::plugins ());
+  tab->addTab (m_docPlugins, i18n("Document Plugins"));
+
+  m_viewPlugins = new PluginListView (tab, false, m_doc, KateFactory::viewPlugins ());
+  tab->addTab (m_viewPlugins, i18n("View Plugins"));
+          
+  tab->show ();}
+
+PluginConfigPage::~PluginConfigPage ()
+{
+}
+
+void PluginConfigPage::apply ()
+{
+
+}
 
 HlConfigPage::HlConfigPage (QWidget *parent, KateDocument *doc) : Kate::ConfigPage (parent, "")
 {

part/part/katedialogs.h

 #include <klistview.h>
 #include <qtabwidget.h>
 #include <kcolorbutton.h>
-#include <qcolor.h>
-#include <qlistview.h>
+#include <qcolor.h>       
+#include <ktrader.h>
+#include <qlistview.h>     
 
 class QWidgetStack;
 class QVBox;
 
 #define HlEUnknown 0
 #define HlEContext 1
-#define HlEItem 2
+#define HlEItem 2     
+
+class PluginListView : public KListView
+{
+  Q_OBJECT
+
+  public:
+    PluginListView (QWidget *parent = 0, bool docPlugins = true, class KateDocument *doc = 0, KTrader::OfferList *plugins = 0);
+    ~PluginListView ();     
+    
+  private:
+    bool m_docPlugins;
+    KateDocument *m_doc;
+    KTrader::OfferList *m_plugins;
+    QPtrList<class PluginListItem> m_items;  
+};
+
+class PluginConfigPage : public Kate::ConfigPage
+{
+  Q_OBJECT
+
+  public:
+    PluginConfigPage (QWidget *parent, class KateDocument *doc);
+    ~PluginConfigPage ();
+
+  private:
+    KateDocument *m_doc;
+    PluginListView *m_docPlugins;
+    PluginListView *m_viewPlugins;
+
+  public slots:
+    void apply ();
+    void reload () {};   
+    void reset () {};
+    void defaults () {};
+};
+
 
 /*
     QListViewItem subclass to display/edit a style, bold/italic is check boxes,

part/part/katedocument.cpp

 
 uint KateDocument::configPages () const
 {
-  return 7;
+  return 8;
 }
 
 KTextEditor::ConfigPage *KateDocument::configPage (uint number, QWidget *parent, const char * )
 
     case 6:
       return hlConfigPage (parent);
+      
+    case 7:
+      return new PluginConfigPage (parent, this);
 
     default:
       return 0;
 
     case 6:
       return i18n ("Highlighting");
+      
+    case 7:
+      return i18n ("Plugins");
 
     default:
       return 0;
 
     case 6:
       return i18n ("Highlighting Rules");
+      
+    case 7:
+      return i18n ("Plugin Manager");
 
     default:
       return 0;
 
     case 6:
       return BarIcon("misc", size);
+      
+    case 7:
+      return BarIcon("misc", size);
 
     default:
       return 0;

part/part/katedocument.h

 class KateCodeFoldingTree;
 class KateBuffer;
 class KateView;
-class KateViewInternal;
+class KateViewInternal; 
 
 //
 // Kate KTextEditor::Document class (and even KTextEditor::Editor ;)
     class KateCmd *myCmd;
 
     QMemArray<Attribute> myAttribs;
-
+    
     //
     // core katedocument config !
     //
     * Implementation of the mark interface
     **/
   public:
+    QStringList loadedPlugins;
+    QStringList loadedViewPlugins;
+  
     /**
       Allow the HlManager to fill the array
     */