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

List:       kde-commits
Subject:    branches/KDE/3.5/kdewebdev/quanta
From:       Andras Mantia <amantia () kde ! org>
Date:       2008-02-05 13:53:42
Message-ID: 1202219622.903350.28476.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 771210 by amantia:

List plugins in the Open With... menu.

 M  +2 -1      ChangeLog  
 M  +5 -5      quanta.kdevelop  
 M  +1 -0      treeviews/Makefile.am  
 M  +42 -8     treeviews/basetreeview.cpp  
 M  +4 -0      treeviews/basetreeview.h  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #771209:771210
@@ -17,8 +17,9 @@
       - make the parser as fast as it was in 3.5.6 and before
       - fix help button in the New Project wizard [#145324]
       - do not add the same entry over and over to the completion list
+- improvements:
+      - list plugins in the Open With... menu.
 
-
 Version 3.5.7 (Release date: xx-xx-2006; Started 06-02-2006)
  - bugfixes:
       - fix directory creation when certain ftp servers are used [#141232]
--- branches/KDE/3.5/kdewebdev/quanta/quanta.kdevelop #771209:771210
@@ -32,7 +32,7 @@
     </configure>
     <make>
       <abortonerror>true</abortonerror>
-      <numberofjobs>4</numberofjobs>
+      <numberofjobs>2</numberofjobs>
       <dontact>false</dontact>
       <makebin/>
       <envvars>
@@ -41,7 +41,7 @@
         <envvar value="1" name="WANT_AUTOMAKE_1_6" />
       </envvars>
       <prio>0</prio>
-      <runmultiplejobs>false</runmultiplejobs>
+      <runmultiplejobs>true</runmultiplejobs>
     </make>
     <compiler>
       <cflags/>
@@ -184,7 +184,7 @@
     </groups>
     <tree>
       <hidenonprojectfiles>false</hidenonprojectfiles>
-      <hidepatterns></hidepatterns>
+      <hidepatterns/>
       <showvcsfields>true</showvcsfields>
     </tree>
   </kdevfileview>
@@ -260,10 +260,10 @@
   </kdevcvs>
   <kdevfilecreate>
     <filetypes>
-      <type icon="" ext="h" create="template" name="C++ header" >
+      <type icon="" ext="h" name="C++ header" create="template" >
         <descr>Quanta speicfic header</descr>
       </type>
-      <type icon="source_cpp" ext="cpp" create="template" name="C++ source" >
+      <type icon="source_cpp" ext="cpp" name="C++ source" create="template" >
         <descr>A new empty C++ file.</descr>
       </type>
     </filetypes>
--- branches/KDE/3.5/kdewebdev/quanta/treeviews/Makefile.am #771209:771210
@@ -20,4 +20,5 @@
 	-I$(top_srcdir)/lib \
 	-I$(top_builddir)/quanta/dialogs/tagdialogs \
 	-I$(top_builddir)/quanta/components/csseditor \
+	-I$(top_srcdir)/quanta/plugins \
 	$(KMDI_INCLUDES) $(CVSSERVICE_INCLUDE) $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS) \
                $(all_includes)
--- branches/KDE/3.5/kdewebdev/quanta/treeviews/basetreeview.cpp #771209:771210
@@ -62,6 +62,8 @@
 #include "qextfileinfo.h"
 #include "viewmanager.h"
 #include "quantanetaccess.h"
+#include "quantaplugininterface.h"
+#include "quantaplugin.h"
 
 #include <X11/Xlib.h>
 
@@ -561,6 +563,21 @@
   }
 }
 
+void BaseTreeView::slotOpenWithActivated(int id)
+{
+  if (m_pluginIds.contains(id))
+  {
+    QuantaPlugin *plugin = m_pluginIds[id];
+    plugin->unload(true);
+    plugin->load();
+    int input = plugin->input();
+    plugin->setInput(-1); //disable input
+    plugin->run();
+    plugin->part()->openURL(currentURL());
+    plugin->setInput(input);
+  }
+}
+
 void BaseTreeView::insertOpenWithMenu(KPopupMenu *menu, int position)
 {
   if (m_openWithMenuId != -1)
@@ -574,19 +591,36 @@
   KURL urlToOpen = currentURL();
   QString mimeType = KMimeType::findByURL(urlToOpen, 0, true, true)->name();
   KTrader::OfferList offers = KTrader::self()->query(mimeType, "Type == \
'Application'"); +  QDict<QuantaPlugin> plugins = \
QuantaPluginInterface::ref()->plugins();    +  m_pluginIds.clear();
 
-  if (offers.count() > 0)
+  if (offers.count() > 0 || plugins.count() > 0)
   {
     m_openWithMenu = new KPopupMenu(this);
-    KTrader::OfferList::Iterator it;
-    for (it = offers.begin(); it != offers.end(); ++it)
+    if (offers.count() > 0) 
     {
-      KAction *action = new KAction((*it)->name(), (*it)->icon(), 0, 0, \
                QFile::encodeName((*it)->desktopEntryPath()).data());
-      connect(action, SIGNAL(activated()), this, SLOT(slotOpenWithApplication()));
-      action->plug(m_openWithMenu);
-      m_openWithActions.append(action);
+      KTrader::OfferList::Iterator it;
+      for (it = offers.begin(); it != offers.end(); ++it)
+      {
+        KAction *action = new KAction((*it)->name(), (*it)->icon(), 0, 0, \
QFile::encodeName((*it)->desktopEntryPath()).data()); +        connect(action, \
SIGNAL(activated()), this, SLOT(slotOpenWithApplication())); +        \
action->plug(m_openWithMenu); +        m_openWithActions.append(action);
+      }
+      m_openWithMenu->insertSeparator();
     }
-    m_openWithMenu->insertSeparator();
+    if (plugins.count() > 0)
+    {
+      m_openWithMenu->insertTitle(i18n("Plugins"));
+      QDictIterator<QuantaPlugin> it2(plugins);
+      for(;it2.current();++it2)
+      {
+        int id = m_openWithMenu->insertItem(KGlobal::iconLoader()->loadIconSet(it2.current()->icon(),KIcon::Small), \
it2.current()->name()); +        m_pluginIds[id] = it2.current();
+      }
+      connect(m_openWithMenu, SIGNAL(activated(int)), \
SLOT(slotOpenWithActivated(int)));     +      m_openWithMenu->insertSeparator();
+    }
     m_openWithMenu->insertItem(i18n("&Other..."), this, SLOT(slotOpenWith()));
     m_openWithMenuId = menu->insertItem(i18n("Open &With"), m_openWithMenu, -1, \
position);  } else
--- branches/KDE/3.5/kdewebdev/quanta/treeviews/basetreeview.h #771209:771210
@@ -44,6 +44,7 @@
 class KURL;
 class FileInfoDlg;
 class BaseTreeViewToolTip;
+class QuantaPlugin;
 
 /**
  * @short a KFileTreeViewItem with some specials.
@@ -259,6 +260,8 @@
    */
   virtual void slotCreateFile();
 
+  virtual void slotOpenWithActivated(int id);
+
 protected:
   /**
   implement this to create a branch and add this branch to the treeview
@@ -353,6 +356,7 @@
   KPopupMenu *m_openWithMenu;
   int m_openWithMenuId;
   QValueList<KAction *> m_openWithActions;
+  QMap<int, QuantaPlugin*> m_pluginIds;
 };
 
 #endif


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

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