Mailinglist Archive: opensuse-commit (1159 mails)

< Previous Next >
commit kdevplatform4
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Sat, 20 Oct 2007 17:45:14 +0200
  • Message-id: <20071020154514.AAF32678331@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package kdevplatform4
checked in at Sat Oct 20 17:45:14 CEST 2007.

--------
--- KDE/kdevplatform4/kdevplatform4.changes     2007-10-18 10:43:16.000000000 +0200
+++ /mounts/work_src_done/STABLE/kdevplatform4/kdevplatform4.changes    2007-10-20 17:44:58.685676000 +0200
@@ -1,0 +2,5 @@
+Sat Oct 20 17:44:34 CEST 2007 - dmueller@xxxxxxx
+
+- update to 3.94.0.svn727388 
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kdevplatform4.spec ++++++
--- /var/tmp/diff_new_pack.G18823/_old  2007-10-20 17:45:08.000000000 +0200
+++ /var/tmp/diff_new_pack.G18823/_new  2007-10-20 17:45:08.000000000 +0200
@@ -1,5 +1,5 @@
 #
-# spec file for package kdevplatform4 (Version 3.94.0.svn724090)
+# spec file for package kdevplatform4 (Version 3.94.0.svn727388)
 #
 # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
 # This file and all modifications and additions to the pristine
@@ -15,7 +15,7 @@
 Group:          Development/Tools/IDE
 Summary:        Base Package for Integrated Development Environments
 Url:            http://www.kdevelop.org
-Version:        3.94.0.svn724090
+Version:        3.94.0.svn727388
 Release:        1
 Source0:        kdevplatform.tar.bz2
 Source1:        _upstream
@@ -176,6 +176,8 @@
 /usr/share/kde4/services/kcm_kdev_envsettings.desktop
 /usr/share/kde4/services/kdevquickopen.desktop
 %changelog
+* Sat Oct 20 2007 - dmueller@xxxxxxx
+- update to 3.94.0.svn727388
 * Thu Oct 18 2007 - dmueller@xxxxxxx
 - update to KDE 4.0 Beta3 state
 * Tue Oct 02 2007 - stbinner@xxxxxxx

++++++ kdevplatform.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/language/duchain/topducontext.cpp new/kdevplatform/language/duchain/topducontext.cpp
--- old/kdevplatform/language/duchain/topducontext.cpp  2007-09-28 21:21:47.000000000 +0200
+++ new/kdevplatform/language/duchain/topducontext.cpp  2007-10-13 21:19:59.000000000 +0200
@@ -39,10 +39,12 @@
     : m_inDuChain(false), m_flags(TopDUContext::NoFlags), m_ctxt(ctxt)
   {
   }
-  bool imports(TopDUContext* origin, int depth) const
+  bool imports(const TopDUContext* origin, int depth) const
   {
-    if(depth == 0) {
-      QHash<TopDUContext*, bool>::const_iterator it = m_importsCache.find(origin);
+    const bool alwaysCache = true;
+    
+    if(alwaysCache || depth == 0) {
+      QHash<const TopDUContext*, bool>::const_iterator it = m_importsCache.find(origin);
       if(it != m_importsCache.end()) {
         return *it;
       }
@@ -63,14 +65,14 @@
       Q_ASSERT(dynamic_cast<TopDUContext*>((*it).data()));
       TopDUContext* top = static_cast<TopDUContext*>((*it).data());
       if (top == origin) {
-        if(depth == 0) {
+        if(alwaysCache || depth == 0) {
           m_importsCache[origin] = true;
         }
         return true;
       }
 
       if (top->d->imports(origin, depth + 1)) {
-        if(depth == 0) {
+        if(alwaysCache || depth == 0) {
           m_importsCache[origin] = true;
         }
         return true;
@@ -86,7 +88,7 @@
   TopDUContext::Flags m_flags;
   TopDUContext* m_ctxt;
   ParsingEnvironmentFilePointer m_file;
-  mutable QHash<TopDUContext*, bool> m_importsCache;
+  mutable QHash<const TopDUContext*, bool> m_importsCache;
 };
 
 TopDUContext::TopDUContext(KTextEditor::Range* range, ParsingEnvironmentFile* file)
@@ -319,7 +321,7 @@
   return d->m_deleting;
 }
 
-bool TopDUContext::imports(TopDUContext * origin, const KTextEditor::Cursor& position) const
+bool TopDUContext::imports(const TopDUContext * origin, const KTextEditor::Cursor& position) const
 {
   ENSURE_CAN_READ
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/language/duchain/topducontext.h new/kdevplatform/language/duchain/topducontext.h
--- old/kdevplatform/language/duchain/topducontext.h    2007-09-28 18:20:56.000000000 +0200
+++ new/kdevplatform/language/duchain/topducontext.h    2007-10-12 14:38:53.000000000 +0200
@@ -75,7 +75,7 @@
    *
    * \note you must be holding a read but not a write chain lock when you access this function.
    */
-  virtual bool imports(TopDUContext* origin, const KTextEditor::Cursor& position) const;
+  virtual bool imports(const TopDUContext* origin, const KTextEditor::Cursor& position) const;
 
   enum Flags {
     NoFlags = 0,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/language/interfaces/iquickopen.h new/kdevplatform/language/interfaces/iquickopen.h
--- old/kdevplatform/language/interfaces/iquickopen.h   2007-10-04 21:41:16.000000000 +0200
+++ new/kdevplatform/language/interfaces/iquickopen.h   2007-10-12 15:58:51.000000000 +0200
@@ -22,6 +22,8 @@
 #include <iextension.h>
 #include <languageexport.h>
 
+class QStringList;
+
 namespace KDevelop
 {
 
@@ -39,11 +41,11 @@
      * Registers a new provider under a specified name.
      * There may be multiple providers with the same type/scope, they will be used simultaneously in that case.
      * type and scope will be shown in the GUI, so they should be translated.
-     * @param scope Scope of the provided data, Examples: "Project", "Imports", etc.
+     * @param scope Different scopes supported by this data-provider, Examples: "Project", "Imports", etc.
      * @param type Type of the provided data, Examples: "Files", "Functiosn", "Classes", etc.
      * @param provider The provider. It does not need to be explicitly removed before its destruction.
      * */
-    virtual void registerProvider( const QString& scope, const QString& type, QuickOpenDataProviderBase* provider ) = 0;
+    virtual void registerProvider( const QStringList& scopes, const QString& type, QuickOpenDataProviderBase* provider ) = 0;
 
     /**
      * Remove provider.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/language/interfaces/quickopendataprovider.cpp new/kdevplatform/language/interfaces/quickopendataprovider.cpp
--- old/kdevplatform/language/interfaces/quickopendataprovider.cpp      2007-10-06 18:14:20.000000000 +0200
+++ new/kdevplatform/language/interfaces/quickopendataprovider.cpp      2007-10-12 15:58:51.000000000 +0200
@@ -31,12 +31,24 @@
       return QIcon();
     }
   
+  bool QuickOpenDataBase::isExpandable() const {
+    return false;
+  }
+
+  QWidget* QuickOpenDataBase::expandingWidget() const {
+    return 0;
+  }
+  
   QList<QVariant> QuickOpenDataBase::highlighting() const {
     return QList<QVariant>();
   }
 
   QuickOpenDataProviderBase::~QuickOpenDataProviderBase() {
   }
+
+  void QuickOpenDataProviderBase::enableScopes( const QStringList& ) {
+  }
+
 }
 
 #include "quickopendataprovider.moc"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/language/interfaces/quickopendataprovider.h new/kdevplatform/language/interfaces/quickopendataprovider.h
--- old/kdevplatform/language/interfaces/quickopendataprovider.h        2007-10-06 19:19:59.000000000 +0200
+++ new/kdevplatform/language/interfaces/quickopendataprovider.h        2007-10-12 15:58:51.000000000 +0200
@@ -68,6 +68,23 @@
      * @return Whether the dialog should be closed.
      * */
     virtual bool execute( QString& filterText ) = 0;
+
+    /**
+     * Return true here if this data-item should be expandable with
+     * an own embedded widget.
+     * The default-implementation returns false.
+     * */
+    virtual bool isExpandable() const;
+
+    /**
+     * This will be called if isExpandable() returns true.
+     *
+     * A widget should be returned that will be embedded into the quickopen-list.
+     * The widget will be owned by the quickopen-list and will be deleted at will.
+     * 
+     * The default-implementation returns 0, which means no widget will be shown.
+     * */
+    virtual QWidget* expandingWidget() const;
 };
 
 typedef KSharedPtr<QuickOpenDataBase> QuickOpenDataPointer;
@@ -114,6 +131,14 @@
      * @param end Return items until here. end <= itemCount()
      * */
     virtual QList<QuickOpenDataPointer> data( uint start, uint end ) const = 0;
+
+    /**
+     * If the data-provider supports multiple different scopes, this will be called
+     * with the enabled scopes.
+     * If the data-provider supports only one scope, this can be ignored.
+     * The list contains all scopes, even those that are not supported by this provider.
+     * */
+    virtual void enableScopes( const QStringList& scopes );
 };
 
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/language/interfaces/quickopenfilter.h new/kdevplatform/language/interfaces/quickopenfilter.h
--- old/kdevplatform/language/interfaces/quickopenfilter.h      2007-10-06 18:14:20.000000000 +0200
+++ new/kdevplatform/language/interfaces/quickopenfilter.h      2007-10-11 17:41:57.000000000 +0200
@@ -50,6 +50,8 @@
 template<class Item>
 class Filter {
   public:
+    virtual ~Filter() {
+    }
     ///Clears the filter, but not the data.
     void clear() {
       m_filtered = m_items;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/filemanager/filemanager.cpp new/kdevplatform/plugins/filemanager/filemanager.cpp
--- old/kdevplatform/plugins/filemanager/filemanager.cpp        2007-10-04 23:15:20.000000000 +0200
+++ new/kdevplatform/plugins/filemanager/filemanager.cpp        2007-10-17 10:18:03.000000000 +0200
@@ -246,17 +246,23 @@
 void FileManager::setupActions()
 {
     KAction *action = KStandardAction::up(this, SLOT(goLeft()), this);
+    action->setShortcutContext(Qt::WidgetShortcut);
     d->addToolButton(action);
+    addAction(action);
 
     action = KStandardAction::home(this, SLOT(goHome()), this);
+    action->setShortcutContext(Qt::WidgetShortcut);
     d->addToolButton(action);
+    addAction(action);
 
     action = new KAction(this);
+    action->setShortcutContext(Qt::WidgetShortcut);
     action->setIcon(KIcon("folder-new"));
     action->setText(i18n("New Folder..."));
     action->setToolTip(i18n("New Folder"));
     connect(action, SIGNAL(triggered(bool)), this, SLOT(newFolder()));
     d->addToolButton(action);
+    addAction(action);
 }
 
 #include "filemanager.moc"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/projectmanagerview/projectmanagerview_part.cpp new/kdevplatform/plugins/projectmanagerview/projectmanagerview_part.cpp
--- old/kdevplatform/plugins/projectmanagerview/projectmanagerview_part.cpp     2007-09-30 20:48:40.000000000 +0200
+++ new/kdevplatform/plugins/projectmanagerview/projectmanagerview_part.cpp     2007-10-17 15:32:38.000000000 +0200
@@ -277,7 +277,7 @@
     {
         core()->projectController()->closeProject( project );
     }
-    d->ctxProjectList.clear();
+    //d->ctxProjectList.clear();
 }
 
 #include "projectmanagerview_part.moc"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.cpp new/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.cpp
--- old/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.cpp      2007-10-03 00:41:56.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.cpp      2007-10-13 14:57:22.000000000 +0200
@@ -28,8 +28,6 @@
 
 ExpandingDelegate::ExpandingDelegate(ExpandingWidgetModel* model, QObject* parent)
   : QItemDelegate(parent)
-  , m_cachedRow(-1)
-  , m_cachedRowSelected(false)
   , m_model(model)
 {
 }
@@ -44,29 +42,21 @@
     model()->placeExpandingWidget(index);
 
   //Make sure the decorations are painted at the top, because the center of expanded items will be filled with the embedded widget.
-  option.decorationAlignment = Qt::AlignTop | option.decorationAlignment;
+  option.decorationAlignment = Qt::AlignTop;
   
   //kDebug() << "Painting row " << index.row() << ", column " << index.column() << ", internal " << index.internalPointer() << ", drawselected " << option.showDecorationSelected << ", selected " << (option.state & QStyle::State_Selected);
 
-  if ((index.row() != m_cachedRow) || ( ( option.state & QStyle::State_Selected  ) == QStyle::State_Selected ) != m_cachedRowSelected) {
-    m_cachedColumnStarts.clear();
-    m_cachedHighlights.clear();
-    m_cachedColumnStart = 0;
+  m_cachedHighlights.clear();
 
-    if (!model()->indexIsItem(index) ) {
-      m_cachedRow = -1;
+  if (!model()->indexIsItem(index) )
       return QItemDelegate::paint(painter, option, index);
-    }
 
-    m_cachedHighlights = createHighlighting(index, option);
+  m_currentColumnStart = 0;
+  m_cachedHighlights = createHighlighting(index, option);
 
-/*    kDebug() << "Highlights for line:";
-    foreach (const QTextLayout::FormatRange& fr, m_cachedHighlights)
-      kDebug() << fr.start << " len " << fr.length << " format ";*/
-    
-    m_cachedRow = index.row();
-    m_cachedRowSelected = option.state & QStyle::State_Selected;
-  }
+  /*kDebug() << "Highlights for line:";
+  foreach (const QTextLayout::FormatRange& fr, m_cachedHighlights)
+    kDebug() << fr.start << " len " << fr.length << " format ";*/
 
   QItemDelegate::paint(painter, option, index);
 }
@@ -106,9 +96,9 @@
 
 void ExpandingDelegate::drawDisplay( QPainter * painter, const QStyleOptionViewItem & option, const QRect & rect, const QString & text ) const
 {
-  if (m_cachedRow == -1)
+/*  if (m_cachedRow == -1)
     return QItemDelegate::drawDisplay(painter, option, rect, text);
-
+*/
   QTextLayout layout(text, option.font, painter->device());
 
   QRect textRect = rect.adjusted(1, 0, -1, 0); // remove width padding
@@ -116,21 +106,21 @@
   QList<QTextLayout::FormatRange> additionalFormats;
 
   for (int i = 0; i < m_cachedHighlights.count(); ++i) {
-    if (m_cachedHighlights[i].start + m_cachedHighlights[i].length <= m_cachedColumnStart)
+    if (m_cachedHighlights[i].start + m_cachedHighlights[i].length <= m_currentColumnStart)
       continue;
 
     if (!additionalFormats.count())
-      if (i != 0 && m_cachedHighlights[i - 1].start + m_cachedHighlights[i - 1].length > m_cachedColumnStart) {
+      if (i != 0 && m_cachedHighlights[i - 1].start + m_cachedHighlights[i - 1].length > m_currentColumnStart) {
         QTextLayout::FormatRange before;
         before.start = 0;
-        before.length = m_cachedHighlights[i - 1].start + m_cachedHighlights[i - 1].length - m_cachedColumnStart;
+        before.length = m_cachedHighlights[i - 1].start + m_cachedHighlights[i - 1].length - m_currentColumnStart;
         before.format = m_cachedHighlights[i - 1].format;
         additionalFormats.append(before);
       }
 
       
     QTextLayout::FormatRange format;
-    format.start = m_cachedHighlights[i].start - m_cachedColumnStart;
+    format.start = m_cachedHighlights[i].start - m_currentColumnStart;
     format.length = m_cachedHighlights[i].length;
     format.format = m_cachedHighlights[i].format;
 
@@ -139,9 +129,19 @@
     additionalFormats.append(format);
   }
 
-  /*kDebug() << "Highlights for text [" << text << "] col start " << m_cachedColumnStart << ":";
-  foreach (const QTextLayout::FormatRange& fr, m_cachedHighlights)
-    kDebug() << fr.start << " len " << fr.length << " format " << fr.format.fontWeight();*/
+  if (additionalFormats.isEmpty()) {
+    QTextLayout::FormatRange format;
+    format.start = 0;
+    format.length = text.length();
+    QTextCharFormat fm;
+    fm.setForeground(option.palette.text());
+    format.format = fm;
+    additionalFormats.append(format);
+  }
+
+  /*kDebug() << "Highlights for text [" << text << "] col start " << m_currentColumnStart << ":";
+  foreach (const QTextLayout::FormatRange& fr, additionalFormats)
+    kDebug() << fr.start << " len " << fr.length << "foreground" << fr.format.foreground() << "background" << fr.format.background();*/
 
   layout.setAdditionalFormats(additionalFormats);
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.h new/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.h
--- old/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.h        2007-10-03 00:41:56.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.h        2007-10-13 01:24:45.000000000 +0200
@@ -69,10 +69,8 @@
     //Called when an item was expanded/unexpanded and the height changed
     virtual void heightChanged() const;
   
-    mutable int m_cachedRow;
-    mutable bool m_cachedRowSelected;
-    mutable int m_cachedColumnStart; //Text-offset for custom highlighting, will be applied to m_cachedHighlights(Only highlights starting after this will be used). Shoult be zero of the highlighting is not taken from kate.
-    mutable QList<int> m_cachedColumnStarts;
+    mutable int m_currentColumnStart; //Text-offset for custom highlighting, will be applied to m_cachedHighlights(Only highlights starting after this will be used). Shoult be zero of the highlighting is not taken from kate.
+    mutable QList<int> m_currentColumnStarts;
     mutable QList<QTextLayout::FormatRange> m_cachedHighlights;
   
   private:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/kdevquickopen.rc new/kdevplatform/plugins/quickopen/kdevquickopen.rc
--- old/kdevplatform/plugins/quickopen/kdevquickopen.rc 2007-10-04 01:27:46.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/kdevquickopen.rc 2007-10-11 19:59:44.000000000 +0200
@@ -1,7 +1,7 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
 <kpartgui name="KDevQuickopen" version="1">
 <MenuBar>
-  <Menu name="tools"><text>&amp;Tools</text>
+  <Menu name="navigation"><text>&amp;Navigation</text>
     <Action name="quick_open"/>
     <Action name="quick_open_file"/>
     <Action name="quick_open_class"/>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/quickopenmodel.cpp new/kdevplatform/plugins/quickopen/quickopenmodel.cpp
--- old/kdevplatform/plugins/quickopen/quickopenmodel.cpp       2007-10-06 21:28:44.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/quickopenmodel.cpp       2007-10-12 15:58:51.000000000 +0200
@@ -18,6 +18,8 @@
 
 #include "quickopenmodel.h"
 
+#include <QTreeView>
+
 #include <ktexteditor/codecompletionmodel.h>
 #include <kdebug.h>
 
@@ -32,8 +34,9 @@
 {
   QStringList scopes;
   foreach( const ProviderEntry& provider, m_providers )
-    if( !scopes.contains( provider.scope ) )
-      scopes << provider.scope;
+    foreach( const QString& scope, provider.scopes )
+      if( !scopes.contains( scope ) )
+        scopes << scope;
   
   return scopes;
 }
@@ -48,10 +51,10 @@
   return types;
 }
 
-void QuickOpenModel::registerProvider( const QString& scope, const QString& type, KDevelop::QuickOpenDataProviderBase* provider )
+void QuickOpenModel::registerProvider( const QStringList& scopes, const QString& type, KDevelop::QuickOpenDataProviderBase* provider )
 {
   ProviderEntry e;
-  e.scope = scope;
+  e.scopes = QSet<QString>::fromList(scopes);
   e.type = type;
   e.provider = provider;
   
@@ -75,15 +78,17 @@
   return false;
 }
 
-void QuickOpenModel::enableProviders( const QStringList& items, const QStringList& scopes )
+void QuickOpenModel::enableProviders( const QStringList& items, const QStringList& _scopes )
 {
+  QSet<QString> scopes = QSet<QString>::fromList( _scopes );
   kDebug() << "params " << items << " " << scopes;
   for( ProviderMap::iterator it = m_providers.begin(); it != m_providers.end(); ++it ) {
-    if( ( scopes.isEmpty() || scopes.contains( (*it).scope ) ) && ( items.contains( (*it).type ) || items.isEmpty() ) ) {
-      kDebug() << "enabling " << (*it).type << " " << (*it).scope;
+    if( ( scopes.isEmpty() || !scopes.intersect( (*it).scopes ).isEmpty() ) && ( items.contains( (*it).type ) || items.isEmpty() ) ) {
+      kDebug() << "enabling " << (*it).type << " " << (*it).scopes;
       (*it).enabled = true;
+      (*it).provider->enableScopes( _scopes );
     } else {
-      kDebug() << "disabling " << (*it).type << " " << (*it).scope;
+      kDebug() << "disabling " << (*it).type << " " << (*it).scopes;
       (*it).enabled = false;
     }
   }
@@ -119,8 +124,10 @@
   removeProvider( dynamic_cast<KDevelop::QuickOpenDataProviderBase*>(obj) );
 }
 
-QModelIndex QuickOpenModel::index( int row, int column, const QModelIndex& parent) const
+QModelIndex QuickOpenModel::index( int row, int column, const QModelIndex& /*parent*/) const
 {
+  if( column >= columnCount() )
+    return QModelIndex();
   return createIndex( row, column );
 }
 
@@ -142,9 +149,18 @@
   return count;
 }
 
-int QuickOpenModel::columnCount( const QModelIndex& ) const
+int QuickOpenModel::columnCount() const
 {
-  return 1;
+  return 2;
+}
+
+int QuickOpenModel::columnCount( const QModelIndex& index ) const
+{
+  if( index.parent().isValid() )
+    return 0;
+  else {
+    return columnCount();
+  }
 }
 
 QVariant QuickOpenModel::data( const QModelIndex& index, int role ) const
@@ -155,10 +171,45 @@
     return QVariant();
 
   switch( role ) {
-    case Qt::DisplayRole:
-      return d->text();
     case KTextEditor::CodeCompletionModel::ItemSelected:
       return d->htmlDescription();
+
+    case KTextEditor::CodeCompletionModel::IsExpandable:
+      return d->isExpandable();
+
+    case KTextEditor::CodeCompletionModel::ExpandingWidget: {
+      QVariant v;
+      QWidget* w =  d->expandingWidget();
+      v.setValue<QWidget*>(w);
+      return v;
+    }
+  }
+  
+  if( index.column() == 1 )
+  {
+    switch( role ) {
+      case Qt::DecorationRole:
+        return d->icon();
+      
+      case Qt::DisplayRole:
+        return d->text();
+    }
+  } else if( index.column() == 0 )
+  {
+    switch( role ) {
+      case Qt::DecorationRole:
+      {
+        if( isExpandable(index) ) {
+          //Show the expanded/unexpanded handles
+          cacheIcons();
+          if( isExpanded(index) ) {
+            return m_expandedIcon;
+          } else {
+            return m_collapsedIcon;
+          }
+        }
+      }
+    }
   }
   
   return ExpandingWidgetModel::data( index, role );
@@ -167,10 +218,13 @@
 QuickOpenDataPointer QuickOpenModel::getItem( int row ) const {
   ///@todo mix all the models alphabetically here. For now, they are simply ordered.
 
+  if( m_cachedData.contains( row ) )
+    return m_cachedData[row];
+  
   foreach( const ProviderEntry& provider, m_providers ) {
     if( !provider.enabled )
       continue;
-    if( row < provider.provider->itemCount() )
+    if( (uint)row < provider.provider->itemCount() )
     {
       QList<QuickOpenDataPointer> items = provider.provider->data( row, row+1 );
       
@@ -179,6 +233,7 @@
         kWarning() << "Provider returned no item";
         return QuickOpenDataPointer();
       } else {
+        m_cachedData[row] = items.first();
         return items.first();
       }
     } else {
@@ -195,7 +250,7 @@
   return m_treeView;
 }
 
-bool QuickOpenModel::indexIsItem(const QModelIndex& index) const {
+bool QuickOpenModel::indexIsItem(const QModelIndex& /*index*/) const {
   return true;
 }
 
@@ -203,7 +258,7 @@
   m_treeView = view;
 }
 
-int QuickOpenModel::contextMatchQuality(const QModelIndex & index) const {
+int QuickOpenModel::contextMatchQuality(const QModelIndex & /*index*/) const {
   return -1;
 }
 
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/quickopenmodel.h new/kdevplatform/plugins/quickopen/quickopenmodel.h
--- old/kdevplatform/plugins/quickopen/quickopenmodel.h 2007-10-06 21:28:44.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/quickopenmodel.h 2007-10-12 15:58:51.000000000 +0200
@@ -22,6 +22,7 @@
 #include <QMultiMap>
 #include <QString>
 #include <QAbstractItemModel>
+#include <QSet>
 
 #include "quickopendataprovider.h"
 #include "expandingtree/expandingwidgetmodel.h"
@@ -31,7 +32,7 @@
   public:
     QuickOpenModel( QWidget* parent );
     
-    void registerProvider( const QString& scope, const QString& type, KDevelop::QuickOpenDataProviderBase* provider );
+    void registerProvider( const QStringList& scopes, const QString& type, KDevelop::QuickOpenDataProviderBase* provider );
 
     /**
      * Remove provider.
@@ -59,6 +60,7 @@
     QModelIndex index( int, int, const QModelIndex& parent ) const;
     QModelIndex parent( const QModelIndex& ) const;
     int rowCount( const QModelIndex& ) const;
+    int columnCount() const;
     int columnCount( const QModelIndex& ) const;
     QVariant data( const QModelIndex&, int ) const;
 
@@ -75,21 +77,21 @@
 
     //The expandingwidgetmodel needs access to the tree-view
     void setTreeView( QTreeView* view );
+    
+    virtual QTreeView* treeView() const;
   public slots:
     void textChanged( const QString& str );
   private slots:
     void destroyed( QObject* obj );
   
   private:
-    virtual QTreeView* treeView() const;
-    
     virtual bool indexIsItem(const QModelIndex& index) const;
     
     virtual int contextMatchQuality(const QModelIndex & index) const;
 
     KDevelop::QuickOpenDataPointer getItem( int row ) const;
     
-    typedef QList<KDevelop::QuickOpenDataPointer> DataList;
+    typedef QHash<uint, KDevelop::QuickOpenDataPointer> DataList;
     mutable DataList m_cachedData;
 
     QTreeView* m_treeView;
@@ -98,7 +100,8 @@
       ProviderEntry() : enabled(false) {
       }
       bool enabled;
-      QString scope, type;
+      QSet<QString> scopes;
+      QString type;
       KDevelop::QuickOpenDataProviderBase* provider;
     };
     
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/quickopen_part.cpp new/kdevplatform/plugins/quickopen/quickopen_part.cpp
--- old/kdevplatform/plugins/quickopen/quickopen_part.cpp       2007-10-07 04:48:57.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/quickopen_part.cpp       2007-10-12 15:58:51.000000000 +0200
@@ -41,6 +41,7 @@
 #include <icore.h>
 #include <iuicontroller.h>
 
+#include "expandingtree/expandingdelegate.h"
 #include "ui_quickopen.h"
 #include "quickopenmodel.h"
 
@@ -52,6 +53,7 @@
   o.setupUi( d );
   o.list->header()->hide();
   o.list->setRootIsDecorated( false );
+  o.list->setItemDelegate( new ExpandingDelegate( m_model, o.list ) );
 
   QStringList allTypes = m_model->allTypes();
   QStringList allScopes = m_model->allScopes();
@@ -103,7 +105,17 @@
 
   o.list->setModel( m_model );
 
+  o.list->setColumnWidth( 0, 20 );
+  
   d->show();
+
+  connect( o.list->selectionModel(), SIGNAL(currentRowChanged( const QModelIndex&, const QModelIndex& )), this, SLOT(currentChanged( const QModelIndex&, const QModelIndex& )) );
+  connect( o.list->selectionModel(), SIGNAL(selectionChanged( const QModelIndex&, const QModelIndex& )), this, SLOT(currentChanged( const QModelIndex&, const QModelIndex& )) );
+}
+
+QuickOpenWidgetHandler::~QuickOpenWidgetHandler() {
+  if( m_model->treeView() == o.list )
+    m_model->setTreeView( 0 );
 }
 
 void QuickOpenWidgetHandler::updateProviders() {
@@ -140,8 +152,6 @@
 }
 
 void QuickOpenWidgetHandler::callRowSelected() {
-  return; ///@todo re-enable once it doesn't crash
-  kDebug() << "callRowSelected";
   QModelIndex currentIndex = o.list->selectionModel()->currentIndex();
   if( currentIndex.isValid() )
     m_model->rowSelected( currentIndex );
@@ -149,6 +159,10 @@
     kDebug() << "current index is not valid";
 }
 
+void QuickOpenWidgetHandler::currentChanged( const QModelIndex& /*current*/, const QModelIndex& /*previous */) {
+  callRowSelected();
+}
+
 void QuickOpenWidgetHandler::accept() {
   QString filterText = o.searchLine->text();
   m_model->execute( o.list->currentIndex(), filterText );
@@ -178,14 +192,32 @@
         if(watched == o.list )
           return false;
         QApplication::sendEvent( o.list, event );
-        callRowSelected();
+      //callRowSelected();
         return true;
       case Qt::Key_Left: {
         //Expand/unexpand
+        QModelIndex row = o.list->selectionModel()->currentIndex();
+        if( row.isValid() ) {
+          row = row.sibling( row.row(), 0 );
+          
+          if( m_model->isExpanded( row ) ) {
+            m_model->setExpanded( row, false );
+            return true;
+          }
+        }
         return false;
       }
       case Qt::Key_Right: {
         //Expand/unexpand
+        QModelIndex row = o.list->selectionModel()->currentIndex();
+        if( row.isValid() ) {
+          row = row.sibling( row.row(), 0 );
+          
+          if( !m_model->isExpanded( row ) ) {
+            m_model->setExpanded( row, true );
+            return true;
+          }
+        }
         return false;
       }
       case Qt::Key_Return:
@@ -220,27 +252,24 @@
 
     ///@todo All the locally created actions do not work,, also not if they are put into actionCollection()
     QAction* quickOpen = actions->addAction("quick_open");
-    QAction* quickOpenFile = actions->addAction("quick_open_file");
-    QAction* quickOpenClass = actions->addAction("quick_open_class");
-    QAction* quickOpenFunction = actions->addAction("quick_open_function");
-
     quickOpen->setText( i18n("&Quick Open") );
-    quickOpenClass->setText( i18n("Quick Open &Class") );
-    quickOpenFunction->setText( i18n("Quick Open &Function") );
-    quickOpenFile->setText( i18n("Quick Open &File") );
-    
     quickOpen->setShortcut( Qt::CTRL | Qt::ALT | Qt::Key_Q );
-    quickOpenClass->setShortcut( Qt::CTRL | Qt::ALT | Qt::Key_C );
-    quickOpenFunction->setShortcut( Qt::CTRL | Qt::ALT | Qt::Key_M );
+    connect(quickOpen, SIGNAL(triggered(bool)), this, SLOT(quickOpen()));
+    
+    QAction* quickOpenFile = actions->addAction("quick_open_file");
+    quickOpenFile->setText( i18n("Quick Open &File") );
     quickOpenFile->setShortcut( Qt::CTRL | Qt::ALT | Qt::Key_O );
+    connect(quickOpenFile, SIGNAL(triggered(bool)), this, SLOT(quickOpenFile()));
 
-    connect(quickOpen, SIGNAL(triggered(bool)), this, SLOT(quickOpen()));
+    QAction* quickOpenClass = actions->addAction("quick_open_class");
+    quickOpenClass->setText( i18n("Quick Open &Class") );
+    quickOpenClass->setShortcut( Qt::CTRL | Qt::ALT | Qt::Key_C );
     connect(quickOpenClass, SIGNAL(triggered(bool)), this, SLOT(quickOpenClass()));
-    connect(quickOpenFunction, SIGNAL(triggered(bool)), this, SLOT(quickOpenFunction()));
-    connect(quickOpenFile, SIGNAL(triggered(bool)), this, SLOT(quickOpenFile()));
 
-    ///Hijack another action, can be removed once the actions above work
-    connect(core()->uiController()->activeMainWindow()->actionCollection()->action("split_horizontal"), SIGNAL(triggered(bool)), this, SLOT(quickOpen()));
+    QAction* quickOpenFunction = actions->addAction("quick_open_function");
+    quickOpenFunction->setText( i18n("Quick Open &Function") );
+    quickOpenFunction->setShortcut( Qt::CTRL | Qt::ALT | Qt::Key_M );
+    connect(quickOpenFunction, SIGNAL(triggered(bool)), this, SLOT(quickOpenFunction()));
 }
 
 QuickOpenPart::~QuickOpenPart()
@@ -269,9 +298,7 @@
     initialItems << i18n("Classes");
   }
   
-  QuickOpenWidgetHandler* u = new QuickOpenWidgetHandler( d, m_model, initialItems, QStringList() );
-  
-  m_model->setTreeView( 0 );
+  new QuickOpenWidgetHandler( d, m_model, initialItems, QStringList() );
 }
 
 
@@ -295,7 +322,7 @@
   showQuickOpen( Classes );
 }
 
-void QuickOpenPart::registerProvider( const QString& scope, const QString& type, KDevelop::QuickOpenDataProviderBase* provider )
+void QuickOpenPart::registerProvider( const QStringList& scope, const QString& type, KDevelop::QuickOpenDataProviderBase* provider )
 {
   m_model->registerProvider( scope, type, provider );
 }
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/quickopen_part.h new/kdevplatform/plugins/quickopen/quickopen_part.h
--- old/kdevplatform/plugins/quickopen/quickopen_part.h 2007-10-06 22:15:51.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/quickopen_part.h 2007-10-12 15:58:51.000000000 +0200
@@ -56,7 +56,7 @@
      * */
     void showQuickOpen( ModelTypes modes = All );
 
-    virtual void registerProvider( const QString& scope, const QString& type, KDevelop::QuickOpenDataProviderBase* provider );
+    virtual void registerProvider( const QStringList& scope, const QString& type, KDevelop::QuickOpenDataProviderBase* provider );
 
     virtual bool removeProvider( KDevelop::QuickOpenDataProviderBase* provider );
     
@@ -79,8 +79,10 @@
    * @param initialScopes List of scopes that should initially be enabled in the quickopen-list. If empty, all are enabled.
    * */
   QuickOpenWidgetHandler( QDialog* d, QuickOpenModel* model, const QStringList& initialItems, const QStringList& initialScopes );
+  ~QuickOpenWidgetHandler();
   
   private slots:
+  void currentChanged( const QModelIndex& current, const QModelIndex& previous );
   void accept();
   void textChanged( const QString& str );
   void updateProviders();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/quickopen/quickopen.ui new/kdevplatform/plugins/quickopen/quickopen.ui
--- old/kdevplatform/plugins/quickopen/quickopen.ui     2007-10-06 21:28:44.000000000 +0200
+++ new/kdevplatform/plugins/quickopen/quickopen.ui     2007-10-11 16:05:18.000000000 +0200
@@ -33,7 +33,11 @@
       </widget>
      </item>
      <item>
-      <widget class="ExpandingTree" name="list" />
+      <widget class="ExpandingTree" name="list" >
+       <property name="focusPolicy" >
+        <enum>Qt::NoFocus</enum>
+       </property>
+      </widget>
      </item>
      <item>
       <layout class="QHBoxLayout" >
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/subversion/svncommitloginputdlg.ui new/kdevplatform/plugins/subversion/svncommitloginputdlg.ui
--- old/kdevplatform/plugins/subversion/svncommitloginputdlg.ui 2007-06-08 17:31:31.000000000 +0200
+++ new/kdevplatform/plugins/subversion/svncommitloginputdlg.ui 2007-10-19 15:51:14.000000000 +0200
@@ -9,9 +9,6 @@
     <height>317</height>
    </rect>
   </property>
-  <property name="windowTitle" >
-   <string/>
-  </property>
   <layout class="QGridLayout" >
    <property name="leftMargin" >
     <number>9</number>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/subversion/uiblameoptiondlg.ui new/kdevplatform/plugins/subversion/uiblameoptiondlg.ui
--- old/kdevplatform/plugins/subversion/uiblameoptiondlg.ui     2007-09-03 00:10:56.000000000 +0200
+++ new/kdevplatform/plugins/subversion/uiblameoptiondlg.ui     2007-10-19 15:51:14.000000000 +0200
@@ -9,9 +9,6 @@
     <height>392</height>
    </rect>
   </property>
-  <property name="windowTitle" >
-   <string/>
-  </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" >
     <widget class="QGroupBox" name="groupBox" >
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/plugins/subversion/uiupdateoptiondlg.ui new/kdevplatform/plugins/subversion/uiupdateoptiondlg.ui
--- old/kdevplatform/plugins/subversion/uiupdateoptiondlg.ui    2007-09-03 00:10:56.000000000 +0200
+++ new/kdevplatform/plugins/subversion/uiupdateoptiondlg.ui    2007-10-19 15:51:14.000000000 +0200
@@ -9,9 +9,6 @@
     <height>252</height>
    </rect>
   </property>
-  <property name="windowTitle" >
-   <string/>
-  </property>
   <layout class="QGridLayout" >
    <property name="leftMargin" >
     <number>9</number>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kdevplatform/shell/projectcontroller.cpp new/kdevplatform/shell/projectcontroller.cpp
--- old/kdevplatform/shell/projectcontroller.cpp        2007-09-30 20:48:40.000000000 +0200
+++ new/kdevplatform/shell/projectcontroller.cpp        2007-10-17 15:32:05.000000000 +0200
@@ -376,6 +376,10 @@
     d->m_projects.removeAll( proj );
     d->m_recentAction->setCurrentAction( 0 );
 //     d->m_isLoaded = false;
+
+    // Unloading (and thus deleting) these plugins is not a good idea just yet
+    // as we're being called by the view part and it gets deleted when we unload the plugin(s)
+    // TODO: find a better place to unload
     if( d->m_projects.isEmpty() )
         d->m_core->pluginController()->unloadPlugins( IPluginController::Project );
 



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread