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

List:       kde-commits
Subject:    KDE/kdesdk/kate/plugins/filebrowser
From:       Rafael Fernández López <ereslibre () kde ! org>
Date:       2008-08-27 15:15:39
Message-ID: 1219850139.780319.2556.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 853336 by ereslibre:

Kate file selector plugin ported


 M  +2 -2      CMakeLists.txt  
 M  +1 -0      katefilebrowserplugin.desktop  
 A             katefilebrowserplugin_config.desktop  
 M  +33 -52    katefileselector.cpp  
 M  +12 -16    katefileselector.h  


--- trunk/KDE/kdesdk/kate/plugins/filebrowser/CMakeLists.txt #853335:853336
@@ -17,5 +17,5 @@
 
 ########### install files ###############
 
-install( FILES katefilebrowserplugin.desktop  DESTINATION  ${SERVICES_INSTALL_DIR} )
-
+install( FILES katefilebrowserplugin.desktop
+               katefilebrowserplugin_config.desktop  DESTINATION  \
                ${SERVICES_INSTALL_DIR} )
--- trunk/KDE/kdesdk/kate/plugins/filebrowser/katefilebrowserplugin.desktop \
#853335:853336 @@ -1,6 +1,7 @@
 [Desktop Entry]
 Type=Service
 ServiceTypes=Kate/Plugin
+X-KDE-PluginInfo-Name=katefilebrowserplugin
 X-KDE-Library=katefilebrowserplugin
 X-Kate-Version=2.8
 Name=File system browser
--- trunk/KDE/kdesdk/kate/plugins/filebrowser/katefileselector.cpp #853335:853336
@@ -68,12 +68,17 @@
 #include <kdeversion.h>
 //END Includes
 
-K_EXPORT_COMPONENT_FACTORY( katefilebrowserplugin, \
KGenericFactory<KateFileSelectorPlugin>( "katefilebrowserplugin" ) ) \
+K_PLUGIN_FACTORY_DECLARATION(KateFileSelectorPluginFactory)  
-KateFileSelectorPlugin::KateFileSelectorPlugin( QObject* parent, const \
                QStringList&):
-    Kate::Plugin ( (Kate::Application*)parent )
-{}
+KateFileSelectorPlugin *KateFileSelectorPlugin::plugin = 0;
 
+KateFileSelectorPlugin::KateFileSelectorPlugin( QObject* parent, const \
QVariantList&): +    Kate::Plugin ( (Kate::Application*)parent ),
+    m_fileSelector(0)
+{
+  plugin = this;
+}
+
 Kate::PluginView *KateFileSelectorPlugin::createView (Kate::MainWindow *mainWindow)
 {
   KateFileSelectorPluginView* kateFileSelectorPluginView = new \
KateFileSelectorPluginView (mainWindow); @@ -105,37 +110,6 @@
   m_fileSelector->writeSessionConfig(config, group);
 }
 
-uint KateFileSelectorPlugin::configPages() const
-{
-  return 1;
-}
-
-Kate::PluginConfigPage *KateFileSelectorPlugin::configPage (uint number, QWidget \
                *parent, const char *name)
-{	
-  if (number != 0) 
-    return 0;
-  return new KFSConfigPage(parent, name, m_fileSelector);
-}
-
-QString KateFileSelectorPlugin::configPageName (uint number) const
-{
-  if (number != 0) return QString();
-  kDebug() << "Returning a config page name";
-  return i18n("File Selector");
-}
-
-QString KateFileSelectorPlugin::configPageFullName (uint number) const
-{
-  if (number != 0) return QString();
-  return i18n("File Selector Settings");
-}
-
-KIcon KateFileSelectorPlugin::configPageIcon (uint number) const
-{
-  if (number != 0) return KIcon();
-  return KIcon("document-open");
-}
-
 //BEGIN Toolbar
 // from kfiledialog.cpp - avoid qt warning in STDERR (~/.xsessionerrors)
 static void silenceQToolBar(QtMsgType, const char *)
@@ -642,11 +616,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 // KFSConfigPage implementation
 ////////////////////////////////////////////////////////////////////////////////
-KFSConfigPage::KFSConfigPage( QWidget *parent, const char *, KateFileSelector *kfs )
-    : Kate::PluginConfigPage( parent ),
-    fileSelector( kfs ),
+KFSConfigPage::KFSConfigPage( QWidget *parent, const QVariantList & )
+    : KCModule( KateFileSelectorPluginFactory::componentData(), parent ),
     m_changed( false )
 {
+  if (!KateFileSelectorPlugin::self() || \
!KateFileSelectorPlugin::self()->m_fileSelector) { +    fileSelector = new \
KateFileSelector; +  } else {
+    fileSelector = KateFileSelectorPlugin::self()->m_fileSelector;
+  }
+
   QVBoxLayout *lo = new QVBoxLayout( this );
   int spacing = KDialog::spacingHint();
   lo->setSpacing( spacing );
@@ -735,13 +714,13 @@
   lbFilterHist->setWhatsThis(fhwt );
   sbFilterHistLength->setWhatsThis(fhwt );
   QString synwt( i18n(
-                   "<p>These options allow you to have the File Selector \
                automatically "
-                   "change location to the folder of the active document on certain \
                "
-                   "events.</p>"
-                   "<p>Auto synchronization is <em>lazy</em>, meaning it will not \
                take "
-                   "effect until the file selector is visible.</p>"
-                   "<p>None of these are enabled by default, but you can always sync \
                the "
-                   "location by pressing the sync button in the toolbar.</p>") );
+                  "<p>These options allow you to have the File Selector \
automatically " +                  "change location to the folder of the active \
document on certain " +                  "events.</p>"
+                  "<p>Auto synchronization is <em>lazy</em>, meaning it will not \
take " +                  "effect until the file selector is visible.</p>"
+                  "<p>None of these are enabled by default, but you can always sync \
the " +                  "location by pressing the sync button in the toolbar.</p>") \
);  gbSync->setWhatsThis(synwt );
   cbSesLocation->setWhatsThis(i18n(
                                 "<p>If this option is enabled (default), the \
location will be restored " @@ -754,12 +733,9 @@
                               "restored.</p>"
                               "<p><strong>Note</strong> that some of the autosync \
                settings may "
                               "override the restored location if on.</p>") );
-
-  init();
-
 }
 
-void KFSConfigPage::apply()
+void KFSConfigPage::save()
 {
   if ( ! m_changed )
     return;
@@ -797,11 +773,10 @@
   fileSelector->writeConfig();
 }
 
-void KFSConfigPage::reset()
+void KFSConfigPage::load()
 {
-  // hmm, what is this supposed to do, actually??
-  init();
   m_changed = false;
+  init();
 }
 void KFSConfigPage::init()
 {
@@ -862,4 +837,10 @@
   emit changed();
 }
 //END KFSConfigPage
+
+K_PLUGIN_FACTORY_DEFINITION(KateFileSelectorPluginFactory,
+        registerPlugin<KFSConfigPage>();
+        registerPlugin<KateFileSelectorPlugin>();
+        )
+K_EXPORT_PLUGIN(KateFileSelectorPluginFactory("katefilebrowserplugin"))
 // kate: space-indent on; indent-width 2; replace-tabs on;
--- trunk/KDE/kdesdk/kate/plugins/filebrowser/katefileselector.h #853335:853336
@@ -27,7 +27,7 @@
 #include <ktexteditor/configpage.h>
 #include <kate/plugin.h>
 #include <kate/mainwindow.h>
-#include <kate/pluginconfigpageinterface.h>
+#include <kcmodule.h>
 #include <kurlcombobox.h>
 
 #include <kvbox.h>
@@ -47,23 +47,21 @@
 
 class KateFileSelector;
 
-class KateFileSelectorPlugin: public Kate::Plugin, public \
Kate::PluginConfigPageInterface +class KateFileSelectorPlugin: public Kate::Plugin
 {
     Q_OBJECT
-    Q_INTERFACES(Kate::PluginConfigPageInterface)
   public:
-    explicit KateFileSelectorPlugin( QObject* parent = 0, const QStringList& = \
QStringList() ); +    explicit KateFileSelectorPlugin( QObject* parent = 0, const \
QVariantList& = QVariantList() );  virtual ~KateFileSelectorPlugin()
-    {}
+    { plugin = 0; m_fileSelector = 0; }
 
+    static KateFileSelectorPlugin *self() { return plugin; }
+
     Kate::PluginView *createView (Kate::MainWindow *mainWindow);
 
-    uint configPages() const;
-    Kate::PluginConfigPage *configPage (uint number = 0, QWidget *parent = 0, const \
                char *name = 0);
-    QString configPageName (uint number = 0) const;
-    QString configPageFullName (uint number = 0) const;
-    KIcon configPageIcon (uint number = 0) const;
     KateFileSelector *m_fileSelector;
+
+    static KateFileSelectorPlugin *plugin;
 };
 
 class KateFileSelectorPluginView : public Kate::PluginView
@@ -199,18 +197,16 @@
     of the path and file filter combos, and how to handle
     user closed session.
 */
-class KFSConfigPage : public Kate::PluginConfigPage
+class KFSConfigPage : public KCModule
 {
     Q_OBJECT
   public:
-    explicit KFSConfigPage( QWidget* parent = 0, const char *name = 0, \
KateFileSelector *kfs = 0); +    explicit KFSConfigPage( QWidget* parent = 0, const \
QVariantList& = QVariantList() );  virtual ~KFSConfigPage()
     {}
 
-    virtual void apply();
-    virtual void reset();
-    virtual void defaults()
-    {}
+    virtual void save();
+    virtual void load();
 
   private Q_SLOTS:
     void slotMyChanged();


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

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